diff --git a/matrix/AxisAngle.hpp b/matrix/AxisAngle.hpp index b86a57930f..e95c046514 100644 --- a/matrix/AxisAngle.hpp +++ b/matrix/AxisAngle.hpp @@ -37,7 +37,7 @@ public: * * @param data_ array */ - AxisAngle(const Type data_[3]) : + explicit AxisAngle(const Type data_[3]) : Vector(data_) { } diff --git a/matrix/Dcm.hpp b/matrix/Dcm.hpp index 31ea35da5c..9a1c6524b2 100644 --- a/matrix/Dcm.hpp +++ b/matrix/Dcm.hpp @@ -56,7 +56,16 @@ public: * * @param _data pointer to array */ - Dcm(const Type *data_) : SquareMatrix(data_) + explicit Dcm(const Type data_[3][3]) : SquareMatrix(data_) + { + } + + /** + * Constructor from array + * + * @param _data pointer to array + */ + explicit Dcm(const Type data_[3*3]) : SquareMatrix(data_) { } diff --git a/matrix/Matrix.hpp b/matrix/Matrix.hpp index 15d042e969..79831f7a7b 100644 --- a/matrix/Matrix.hpp +++ b/matrix/Matrix.hpp @@ -41,12 +41,12 @@ public: // Constructors Matrix() = default; - Matrix(const Type data_[M*N]) + explicit Matrix(const Type data_[M*N]) { memcpy(_data, data_, sizeof(_data)); } - Matrix(const Type data_[M][N]) + explicit Matrix(const Type data_[M][N]) { memcpy(_data, data_, sizeof(_data)); } diff --git a/matrix/Quaternion.hpp b/matrix/Quaternion.hpp index ffa00b602b..a99a290f52 100644 --- a/matrix/Quaternion.hpp +++ b/matrix/Quaternion.hpp @@ -61,7 +61,7 @@ public: * * @param data_ array */ - Quaternion(const Type data_[4]) : + explicit Quaternion(const Type data_[4]) : Vector(data_) { } diff --git a/matrix/SquareMatrix.hpp b/matrix/SquareMatrix.hpp index 6a8ed55606..aaface6627 100644 --- a/matrix/SquareMatrix.hpp +++ b/matrix/SquareMatrix.hpp @@ -28,7 +28,12 @@ class SquareMatrix : public Matrix public: SquareMatrix() = default; - SquareMatrix(const Type data_[M][M]) : + explicit SquareMatrix(const Type data_[M][M]) : + Matrix(data_) + { + } + + explicit SquareMatrix(const Type data_[M*M]) : Matrix(data_) { } diff --git a/matrix/Vector.hpp b/matrix/Vector.hpp index edac621ca6..e46247539f 100644 --- a/matrix/Vector.hpp +++ b/matrix/Vector.hpp @@ -29,7 +29,7 @@ public: { } - Vector(const Type data_[M]) : + explicit Vector(const Type data_[M]) : MatrixM1(data_) { } diff --git a/matrix/Vector2.hpp b/matrix/Vector2.hpp index 5e209bbbf2..4ca5023ad1 100644 --- a/matrix/Vector2.hpp +++ b/matrix/Vector2.hpp @@ -31,7 +31,7 @@ public: { } - Vector2(const Type data_[2]) : + explicit Vector2(const Type data_[2]) : Vector(data_) { } diff --git a/matrix/Vector3.hpp b/matrix/Vector3.hpp index 4f2de37f0b..e449b2657f 100644 --- a/matrix/Vector3.hpp +++ b/matrix/Vector3.hpp @@ -39,7 +39,7 @@ public: { } - Vector3(const Type data_[3]) : + explicit Vector3(const Type data_[3]) : Vector(data_) { } diff --git a/test/attitude.cpp b/test/attitude.cpp index becb39602f..00f7a6fb6a 100644 --- a/test/attitude.cpp +++ b/test/attitude.cpp @@ -4,11 +4,10 @@ using namespace matrix; -namespace matrix { - // manually instantiated all files we intend to test // so that coverage works correctly // doesn't matter what test this is in +namespace matrix { template class Matrix; template class Vector3; template class Vector2; @@ -17,13 +16,10 @@ template class Quaternion; template class AxisAngle; template class Scalar; template class SquareMatrix; - } int main() { - - // check data Eulerf euler_check(0.1f, 0.2f, 0.3f); Quatf q_check(0.98334744f, 0.0342708f, 0.10602051f, .14357218f);