mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-17 20:03:17 +08:00
fix warning with gcc 4.2
This commit is contained in:
parent
d5319f4ba8
commit
432fcefcb1
@ -63,37 +63,37 @@ template<typename _Scalar> class AlignedVector3
|
|||||||
typedef Matrix<_Scalar,4,1> CoeffType;
|
typedef Matrix<_Scalar,4,1> CoeffType;
|
||||||
CoeffType m_coeffs;
|
CoeffType m_coeffs;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_GENERIC_PUBLIC_INTERFACE(AlignedVector3)
|
EIGEN_GENERIC_PUBLIC_INTERFACE(AlignedVector3)
|
||||||
using Base::operator*;
|
using Base::operator*;
|
||||||
|
|
||||||
inline int rows() const { return 3; }
|
inline int rows() const { return 3; }
|
||||||
inline int cols() const { return 1; }
|
inline int cols() const { return 1; }
|
||||||
|
|
||||||
inline const Scalar& coeff(int row, int col) const
|
inline const Scalar& coeff(int row, int col) const
|
||||||
{ return m_coeffs.coeff(row, col); }
|
{ return m_coeffs.coeff(row, col); }
|
||||||
|
|
||||||
inline Scalar& coeffRef(int row, int col)
|
inline Scalar& coeffRef(int row, int col)
|
||||||
{ return m_coeffs.coeffRef(row, col); }
|
{ return m_coeffs.coeffRef(row, col); }
|
||||||
|
|
||||||
inline const Scalar& coeff(int index) const
|
inline const Scalar& coeff(int index) const
|
||||||
{ return m_coeffs.coeff(index); }
|
{ return m_coeffs.coeff(index); }
|
||||||
|
|
||||||
inline Scalar& coeffRef(int index)
|
inline Scalar& coeffRef(int index)
|
||||||
{ return m_coeffs.coeffRef(index);}
|
{ return m_coeffs.coeffRef(index);}
|
||||||
|
|
||||||
|
|
||||||
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))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline AlignedVector3(const AlignedVector3& other)
|
inline AlignedVector3(const AlignedVector3& other)
|
||||||
: m_coeffs(other.m_coeffs)
|
: Base(), m_coeffs(other.m_coeffs)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename XprType, int Size=XprType::SizeAtCompileTime>
|
template<typename XprType, int Size=XprType::SizeAtCompileTime>
|
||||||
struct generic_assign_selector {};
|
struct generic_assign_selector {};
|
||||||
|
|
||||||
template<typename XprType> struct generic_assign_selector<XprType,4>
|
template<typename XprType> struct generic_assign_selector<XprType,4>
|
||||||
{
|
{
|
||||||
inline static void run(AlignedVector3& dest, const XprType& src)
|
inline static void run(AlignedVector3& dest, const XprType& src)
|
||||||
@ -101,7 +101,7 @@ template<typename _Scalar> class AlignedVector3
|
|||||||
dest.m_coeffs = src;
|
dest.m_coeffs = src;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename XprType> struct generic_assign_selector<XprType,3>
|
template<typename XprType> struct generic_assign_selector<XprType,3>
|
||||||
{
|
{
|
||||||
inline static void run(AlignedVector3& dest, const XprType& src)
|
inline static void run(AlignedVector3& dest, const XprType& src)
|
||||||
@ -110,44 +110,44 @@ template<typename _Scalar> class AlignedVector3
|
|||||||
dest.m_coeffs.w() = Scalar(0);
|
dest.m_coeffs.w() = Scalar(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline explicit AlignedVector3(const MatrixBase<Derived>& other)
|
inline explicit AlignedVector3(const MatrixBase<Derived>& other)
|
||||||
{
|
{
|
||||||
generic_assign_selector<Derived>::run(*this,other.derived());
|
generic_assign_selector<Derived>::run(*this,other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
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; }
|
||||||
|
|
||||||
|
|
||||||
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 AlignedVector3& other)
|
inline AlignedVector3& operator+=(const AlignedVector3& other)
|
||||||
{ m_coeffs += other.m_coeffs; return *this; }
|
{ m_coeffs += other.m_coeffs; return *this; }
|
||||||
|
|
||||||
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 AlignedVector3& other)
|
inline AlignedVector3 operator-=(const AlignedVector3& other)
|
||||||
{ m_coeffs -= other.m_coeffs; return *this; }
|
{ m_coeffs -= other.m_coeffs; return *this; }
|
||||||
|
|
||||||
inline AlignedVector3 operator*(const Scalar& s) const
|
inline AlignedVector3 operator*(const Scalar& s) const
|
||||||
{ return AlignedVector3(m_coeffs * s); }
|
{ return AlignedVector3(m_coeffs * s); }
|
||||||
|
|
||||||
inline friend AlignedVector3 operator*(const Scalar& s,const AlignedVector3& vec)
|
inline friend AlignedVector3 operator*(const Scalar& s,const AlignedVector3& vec)
|
||||||
{ return AlignedVector3(s * vec.m_coeffs); }
|
{ return AlignedVector3(s * vec.m_coeffs); }
|
||||||
|
|
||||||
inline AlignedVector3& operator*=(const Scalar& s)
|
inline AlignedVector3& operator*=(const Scalar& s)
|
||||||
{ m_coeffs *= s; return *this; }
|
{ m_coeffs *= s; return *this; }
|
||||||
|
|
||||||
inline AlignedVector3 operator/(const Scalar& s) const
|
inline AlignedVector3 operator/(const Scalar& s) const
|
||||||
{ return AlignedVector3(m_coeffs / s); }
|
{ return AlignedVector3(m_coeffs / s); }
|
||||||
|
|
||||||
inline AlignedVector3& operator/=(const Scalar& s)
|
inline AlignedVector3& operator/=(const Scalar& s)
|
||||||
{ m_coeffs /= s; return *this; }
|
{ m_coeffs /= s; return *this; }
|
||||||
|
|
||||||
inline Scalar dot(const AlignedVector3& other) const
|
inline Scalar dot(const AlignedVector3& other) const
|
||||||
{
|
{
|
||||||
ei_assert(m_coeffs.w()==Scalar(0));
|
ei_assert(m_coeffs.w()==Scalar(0));
|
||||||
@ -164,29 +164,29 @@ template<typename _Scalar> class AlignedVector3
|
|||||||
{
|
{
|
||||||
return AlignedVector3(m_coeffs / norm());
|
return AlignedVector3(m_coeffs / norm());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Scalar sum() const
|
inline Scalar sum() const
|
||||||
{
|
{
|
||||||
ei_assert(m_coeffs.w()==Scalar(0));
|
ei_assert(m_coeffs.w()==Scalar(0));
|
||||||
return m_coeffs.sum();
|
return m_coeffs.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Scalar squaredNorm() const
|
inline Scalar squaredNorm() const
|
||||||
{
|
{
|
||||||
ei_assert(m_coeffs.w()==Scalar(0));
|
ei_assert(m_coeffs.w()==Scalar(0));
|
||||||
return m_coeffs.squaredNorm();
|
return m_coeffs.squaredNorm();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Scalar norm() const
|
inline Scalar norm() const
|
||||||
{
|
{
|
||||||
return ei_sqrt(squaredNorm());
|
return ei_sqrt(squaredNorm());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline AlignedVector3 cross(const AlignedVector3& other) const
|
inline AlignedVector3 cross(const AlignedVector3& other) const
|
||||||
{
|
{
|
||||||
return AlignedVector3(m_coeffs.cross3(other.m_coeffs));
|
return AlignedVector3(m_coeffs.cross3(other.m_coeffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool isApprox(const MatrixBase<Derived>& other, RealScalar eps=precision<Scalar>()) const
|
inline bool isApprox(const MatrixBase<Derived>& other, RealScalar eps=precision<Scalar>()) const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user