44 : traits<Matrix<_Scalar,3,1,0,4,1> >
49template<
typename _Scalar>
class AlignedVector3
57 EIGEN_DENSE_PUBLIC_INTERFACE(AlignedVector3)
58 using Base::operator*;
63 Scalar* data() {
return m_coeffs.data(); }
64 const Scalar* data()
const {
return m_coeffs.data(); }
69 {
return m_coeffs.coeff(
row,
col); }
72 {
return m_coeffs.coeffRef(
row,
col); }
75 {
return m_coeffs.coeff(index); }
78 {
return m_coeffs.coeffRef(index);}
81 inline AlignedVector3()
88 inline AlignedVector3(
const AlignedVector3& other)
89 : Base(), m_coeffs(other.m_coeffs)
92 template<
typename XprType,
int Size=XprType::SizeAtCompileTime>
93 struct generic_assign_selector {};
95 template<
typename XprType>
struct generic_assign_selector<XprType,4>
97 inline static void run(AlignedVector3& dest,
const XprType& src)
103 template<
typename XprType>
struct generic_assign_selector<XprType,3>
105 inline static void run(AlignedVector3& dest,
const XprType& src)
107 dest.m_coeffs.template
head<3>() = src;
108 dest.m_coeffs.w() =
Scalar(0);
112 template<
typename Derived>
115 generic_assign_selector<Derived>::run(*
this,other.
derived());
118 inline AlignedVector3& operator=(
const AlignedVector3& other)
119 { m_coeffs = other.m_coeffs;
return *
this; }
121 template <
typename Derived>
124 generic_assign_selector<Derived>::run(*
this,other.
derived());
128 inline AlignedVector3 operator+(
const AlignedVector3& other)
const
129 {
return AlignedVector3(m_coeffs + other.m_coeffs); }
131 inline AlignedVector3& operator+=(
const AlignedVector3& other)
132 { m_coeffs += other.m_coeffs;
return *
this; }
134 inline AlignedVector3
operator-(
const AlignedVector3& other)
const
135 {
return AlignedVector3(m_coeffs - other.m_coeffs); }
138 {
return AlignedVector3(-m_coeffs); }
140 inline AlignedVector3 operator-=(
const AlignedVector3& other)
141 { m_coeffs -= other.m_coeffs;
return *
this; }
143 inline AlignedVector3 operator*(
const Scalar& s)
const
144 {
return AlignedVector3(m_coeffs * s); }
146 inline friend AlignedVector3 operator*(
const Scalar& s,
const AlignedVector3& vec)
147 {
return AlignedVector3(s * vec.m_coeffs); }
149 inline AlignedVector3& operator*=(
const Scalar& s)
150 { m_coeffs *= s;
return *
this; }
152 inline AlignedVector3 operator/(
const Scalar& s)
const
153 {
return AlignedVector3(m_coeffs / s); }
155 inline AlignedVector3& operator/=(
const Scalar& s)
156 { m_coeffs /= s;
return *
this; }
158 inline Scalar dot(
const AlignedVector3& other)
const
160 eigen_assert(m_coeffs.w()==
Scalar(0));
161 eigen_assert(other.m_coeffs.w()==
Scalar(0));
162 return m_coeffs.dot(other.m_coeffs);
172 return AlignedVector3(m_coeffs /
norm());
177 eigen_assert(m_coeffs.w()==
Scalar(0));
178 return m_coeffs.sum();
183 eigen_assert(m_coeffs.w()==
Scalar(0));
184 return m_coeffs.squaredNorm();
193 inline AlignedVector3 cross(
const AlignedVector3& other)
const
195 return AlignedVector3(m_coeffs.cross3(other.m_coeffs));
198 template<
typename Derived>
201 return m_coeffs.template
head<3>().isApprox(other,eps);
204 CoeffType& coeffs() {
return m_coeffs; }
205 const CoeffType& coeffs()
const {
return m_coeffs; }