48 :
public MatrixBase<AlignedVector3<_Scalar> >
50 typedef Matrix<_Scalar,4,1> CoeffType;
54 typedef MatrixBase<AlignedVector3<_Scalar> > Base;
56 using Base::operator*;
58 inline Index rows()
const {
return 3; }
59 inline Index cols()
const {
return 1; }
61 Scalar* data() {
return m_coeffs.data(); }
62 const Scalar* data()
const {
return m_coeffs.data(); }
63 Index innerStride()
const {
return 1; }
64 Index outerStride()
const {
return 3; }
66 inline const Scalar& coeff(Index row, Index col)
const
67 {
return m_coeffs.coeff(row, col); }
69 inline Scalar& coeffRef(Index row, Index col)
70 {
return m_coeffs.coeffRef(row, col); }
72 inline const Scalar& coeff(Index index)
const
73 {
return m_coeffs.coeff(index); }
75 inline Scalar& coeffRef(Index index)
76 {
return m_coeffs.coeffRef(index);}
79 inline AlignedVector3(
const Scalar& x,
const Scalar& y,
const Scalar& z)
80 : m_coeffs(x, y, z, Scalar(0))
84 : Base(), m_coeffs(other.m_coeffs)
87 template<
typename XprType,
int Size=XprType::SizeAtCompileTime>
88 struct generic_assign_selector {};
90 template<
typename XprType>
struct generic_assign_selector<XprType,4>
98 template<
typename XprType>
struct generic_assign_selector<XprType,3>
102 dest.m_coeffs.template head<3>() = src;
103 dest.m_coeffs.w() = Scalar(0);
107 template<
typename Derived>
110 generic_assign_selector<Derived>::run(*
this,other.derived());
114 { m_coeffs = other.m_coeffs;
return *
this; }
116 template <
typename Derived>
117 inline AlignedVector3& operator=(
const MatrixBase<Derived>& other)
119 generic_assign_selector<Derived>::run(*
this,other.derived());
127 { m_coeffs += other.m_coeffs;
return *
this; }
133 { m_coeffs -= other.m_coeffs;
return *
this; }
142 { m_coeffs *= s;
return *
this; }
148 { m_coeffs /= s;
return *
this; }
152 eigen_assert(m_coeffs.w()==Scalar(0));
153 eigen_assert(other.m_coeffs.w()==Scalar(0));
154 return m_coeffs.dot(other.m_coeffs);
157 inline void normalize()
167 inline Scalar sum()
const
169 eigen_assert(m_coeffs.w()==Scalar(0));
170 return m_coeffs.sum();
173 inline Scalar squaredNorm()
const
175 eigen_assert(m_coeffs.w()==Scalar(0));
176 return m_coeffs.squaredNorm();
179 inline Scalar norm()
const
182 return sqrt(squaredNorm());
190 template<
typename Derived>
191 inline bool isApprox(
const MatrixBase<Derived>& other,
const RealScalar& eps=NumTraits<Scalar>::dummy_precision())
const
193 return m_coeffs.template head<3>().isApprox(other,eps);
196 CoeffType& coeffs() {
return m_coeffs; }
197 const CoeffType& coeffs()
const {
return m_coeffs; }