diff options
author | Janek Kozicki <jkozicki-yade@pg.edu.pl> | 2019-12-05 17:18:05 +0100 |
---|---|---|
committer | Janek Kozicki <jkozicki-yade@pg.edu.pl> | 2019-12-06 21:07:39 +0100 |
commit | 11d6465326a047663fa5961a865fbd15df6e29e4 (patch) | |
tree | 29c7055949037cba2e66b5bfb6b8ea49f0795043 | |
parent | bb7ccac3af90acb15e1bdc3943758ebb2ae22790 (diff) |
fix AlignedVector3 inconsisent interface with other Vector classes, default constructor and operator- were missing.
-rw-r--r-- | unsupported/Eigen/AlignedVector3 | 6 | ||||
-rw-r--r-- | unsupported/test/alignedvector3.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/unsupported/Eigen/AlignedVector3 b/unsupported/Eigen/AlignedVector3 index a67ee6e42..4fa1842ac 100644 --- a/unsupported/Eigen/AlignedVector3 +++ b/unsupported/Eigen/AlignedVector3 @@ -78,6 +78,9 @@ template<typename _Scalar> class AlignedVector3 { return m_coeffs.coeffRef(index);} + inline AlignedVector3() + {} + inline AlignedVector3(const Scalar& x, const Scalar& y, const Scalar& z) : m_coeffs(x, y, z, Scalar(0)) {} @@ -131,6 +134,9 @@ template<typename _Scalar> class AlignedVector3 inline AlignedVector3 operator-(const AlignedVector3& other) const { return AlignedVector3(m_coeffs - other.m_coeffs); } + inline AlignedVector3 operator-() const + { return AlignedVector3(-m_coeffs); } + inline AlignedVector3 operator-=(const AlignedVector3& other) { m_coeffs -= other.m_coeffs; return *this; } diff --git a/unsupported/test/alignedvector3.cpp b/unsupported/test/alignedvector3.cpp index fcc89daab..f442e416a 100644 --- a/unsupported/test/alignedvector3.cpp +++ b/unsupported/test/alignedvector3.cpp @@ -70,6 +70,9 @@ void alignedvector3() VERIFY_IS_APPROX(f6,r1-r4); } + FastType f8, f9(0,0,0); + VERIFY_IS_APPROX(f9-f1,-f1); + std::stringstream ss1, ss2; ss1 << f1; ss2 << r1; |