Browse Source

Merge pull request #1977 from devbharat/fix_issue_1963

Shifted the set() function for Matrix3x3, Vector2, Vector3, Vector4 to a...
sbg
Lorenz Meier 10 years ago
parent
commit
9745d16905
  1. 24
      src/lib/mathlib/math/Matrix.hpp
  2. 25
      src/lib/mathlib/math/Vector.hpp

24
src/lib/mathlib/math/Matrix.hpp

@ -126,15 +126,6 @@ public: @@ -126,15 +126,6 @@ public:
memcpy(data, d, sizeof(data));
}
#if defined(__PX4_ROS)
/**
* set data from boost::array
*/
void set(const boost::array<float, 9ul> d) {
set(static_cast<const float*>(d.data()));
}
#endif
/**
* set row from vector
*/
@ -445,6 +436,21 @@ public: @@ -445,6 +436,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<float, 9ul> d) {
set(static_cast<const float*>(d.data()));
}
#endif
/**
* set to value

25
src/lib/mathlib/math/Vector.hpp

@ -407,7 +407,14 @@ public: @@ -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<float, 2ul> d) {
set(static_cast<const float*>(d.data()));
}
#endif
/**
* set to value
*/
@ -444,6 +451,14 @@ public: @@ -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<float, 3ul> d) {
set(static_cast<const float*>(d.data()));
}
#endif
/**
* set data
@ -494,6 +509,14 @@ public: @@ -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<float, 4ul> d) {
set(static_cast<const float*>(d.data()));
}
#endif
/**
* set data

Loading…
Cancel
Save