fix AlignedVector3 inconsisent interface with other Vector classes, default constructor and operator- were missing.

This commit is contained in:
Janek Kozicki 2019-12-05 17:18:05 +01:00
parent bb7ccac3af
commit 11d6465326
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,9 @@ template<typename _Scalar> class AlignedVector3
{ return m_coeffs.coeffRef(index);} { return m_coeffs.coeffRef(index);}
inline AlignedVector3()
{}
inline AlignedVector3(const Scalar& x, const Scalar& y, const Scalar& z) inline AlignedVector3(const Scalar& x, const Scalar& y, const Scalar& z)
: m_coeffs(x, y, z, Scalar(0)) : m_coeffs(x, y, z, Scalar(0))
{} {}
@ -131,6 +134,9 @@ template<typename _Scalar> class AlignedVector3
inline AlignedVector3 operator-(const AlignedVector3& other) const inline AlignedVector3 operator-(const AlignedVector3& other) const
{ return AlignedVector3(m_coeffs - other.m_coeffs); } { return AlignedVector3(m_coeffs - other.m_coeffs); }
inline AlignedVector3 operator-() const
{ return AlignedVector3(-m_coeffs); }
inline AlignedVector3 operator-=(const AlignedVector3& other) inline AlignedVector3 operator-=(const AlignedVector3& other)
{ m_coeffs -= other.m_coeffs; return *this; } { m_coeffs -= other.m_coeffs; return *this; }

View File

@ -70,6 +70,9 @@ void alignedvector3()
VERIFY_IS_APPROX(f6,r1-r4); VERIFY_IS_APPROX(f6,r1-r4);
} }
FastType f8, f9(0,0,0);
VERIFY_IS_APPROX(f9-f1,-f1);
std::stringstream ss1, ss2; std::stringstream ss1, ss2;
ss1 << f1; ss1 << f1;
ss2 << r1; ss2 << r1;