From f7bd1053403d6eca689555ca8e2ca040ec75879e Mon Sep 17 00:00:00 2001 From: Bharat Tak Date: Fri, 3 Apr 2015 11:34:50 +0200 Subject: [PATCH] Shifted the set() function for Matrix3x3, Vector2, Vector3, Vector4 to appropriate derived class. --- src/lib/mathlib/math/Matrix.hpp | 24 +++++++++++++++--------- src/lib/mathlib/math/Vector.hpp | 25 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/lib/mathlib/math/Matrix.hpp b/src/lib/mathlib/math/Matrix.hpp index f6f4fc5ead..b36c016275 100644 --- a/src/lib/mathlib/math/Matrix.hpp +++ b/src/lib/mathlib/math/Matrix.hpp @@ -126,15 +126,6 @@ public: memcpy(data, d, sizeof(data)); } -#if defined(__PX4_ROS) - /** - * set data from boost::array - */ - void set(const boost::array d) { - set(static_cast(d.data())); - } -#endif - /** * access by index */ @@ -427,6 +418,21 @@ public: Matrix(const float *d) : MatrixBase<3, 3>(d) {} Matrix(const float d[3][3]) : MatrixBase<3, 3>(d) {} + /** + * set data + */ + void set(const float d[9]) { + memcpy(data, d, sizeof(data)); + } + +#if defined(__PX4_ROS) + /** + * set data from boost::array + */ + void set(const boost::array d) { + set(static_cast(d.data())); + } +#endif /** * set to value diff --git a/src/lib/mathlib/math/Vector.hpp b/src/lib/mathlib/math/Vector.hpp index 781c14d539..cf517b9f26 100644 --- a/src/lib/mathlib/math/Vector.hpp +++ b/src/lib/mathlib/math/Vector.hpp @@ -407,7 +407,14 @@ public: data[0] = d[0]; data[1] = d[1]; } - +#if defined(__PX4_ROS) + /** + * set data from boost::array + */ + void set(const boost::array d) { + set(static_cast(d.data())); + } +#endif /** * set to value */ @@ -444,6 +451,14 @@ public: data[1] = y; data[2] = z; } +#if defined(__PX4_ROS) + /** + * set data from boost::array + */ + void set(const boost::array d) { + set(static_cast(d.data())); + } +#endif /** * set data @@ -494,6 +509,14 @@ public: data[2] = x2; data[3] = x3; } +#if defined(__PX4_ROS) + /** + * set data from boost::array + */ + void set(const boost::array d) { + set(static_cast(d.data())); + } +#endif /** * set data