Browse Source

Math : Replaced vector with array in Bezier class and fixed indentation

pull/165/head
Ashwin Ravichandran 10 years ago
parent
commit
6c420936ff
  1. 7
      src/Magnum/Math/Bezier.h
  2. 1
      src/Magnum/Math/Test/BezierTest.cpp

7
src/Magnum/Math/Bezier.h

@ -30,7 +30,7 @@
* @brief Class @ref Magnum::Math::Bezier * @brief Class @ref Magnum::Math::Bezier
*/ */
#include <vector> #include <array>
#include "Vector.h" #include "Vector.h"
namespace Magnum { namespace Math { namespace Magnum { namespace Math {
@ -87,9 +87,9 @@ namespace Magnum { namespace Math {
* @param t The interpolation factor * @param t The interpolation factor
* *
*/ */
std::vector<std::vector<Vector<dimensions, T>>> calculateIntermediatePoints(Float t) const { std::array<std::array<Vector<dimensions,T>, order + 1>, order + 1> calculateIntermediatePoints(Float t) const {
const auto n = order + 1; const auto n = order + 1;
std::vector<std::vector<Vector<dimensions,T>>> i_points(n,std::vector<Vector<dimensions,T>>(n)); std::array<std::array<Vector<dimensions,T>, n>, n> i_points;
for (UnsignedInt i = 0; i < n; ++i) { for (UnsignedInt i = 0; i < n; ++i) {
i_points[i][0] = _points[i]; i_points[i][0] = _points[i];
} }
@ -115,3 +115,4 @@ namespace Magnum { namespace Math {
} }
#endif //Magnum_Math_Bezier_h #endif //Magnum_Math_Bezier_h

1
src/Magnum/Math/Test/BezierTest.cpp

@ -24,6 +24,7 @@
*/ */
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include <array>
#include "Magnum/Math/Bezier.h" #include "Magnum/Math/Bezier.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test {

Loading…
Cancel
Save