10#ifndef EIGEN_ALIGNED_VECTOR3
11#define EIGEN_ALIGNED_VECTOR3
13#include "../../Eigen/Geometry"
15#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
40template<
typename _Scalar>
class AlignedVector3;
43template<
typename _Scalar>
struct traits<AlignedVector3<_Scalar> >
44 : traits<Matrix<_Scalar,3,1,0,4,1> >
58 using Base::operator*;
60 inline Index rows()
const {
return 3; }
61 inline Index cols()
const {
return 1; }
64 const Scalar* data()
const {
return m_coeffs.
data(); }
65 Index innerStride()
const {
return 1; }
66 Index outerStride()
const {
return 3; }
69 {
return m_coeffs.
coeff(row, col); }
72 {
return m_coeffs.
coeffRef(row, col); }
75 {
return m_coeffs.
coeff(index); }
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>
103 template<
typename XprType>
struct generic_assign_selector<XprType,3>
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());
119 { m_coeffs = other.m_coeffs;
return *
this; }
121 template <
typename Derived>
124 generic_assign_selector<Derived>::run(*
this,other.
derived());
132 { m_coeffs += other.m_coeffs;
return *
this; }
141 { m_coeffs -= other.m_coeffs;
return *
this; }
150 { m_coeffs *= s;
return *
this; }
156 { m_coeffs /= s;
return *
this; }
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);
165 inline void normalize()
177 eigen_assert(m_coeffs.w()==
Scalar(0));
178 return m_coeffs.sum();
181 inline Scalar squaredNorm()
const
183 eigen_assert(m_coeffs.w()==
Scalar(0));
184 return m_coeffs.squaredNorm();
187 inline Scalar norm()
const
190 return sqrt(squaredNorm());
198 template<
typename Derived>
201 return m_coeffs.template head<3>().isApprox(other,eps);
205 const CoeffType& coeffs()
const {
return m_coeffs; }
210template<
typename _Scalar>
216template<
typename Scalar>
217struct evaluator<AlignedVector3<Scalar> >
218 : evaluator<Matrix<Scalar,4,1> >
220 typedef AlignedVector3<Scalar> XprType;
221 typedef evaluator<Matrix<Scalar,4,1> > Base;
223 evaluator(
const XprType &m) : Base(m.coeffs()) {}
232#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
A vectorization friendly 3D vector.
Definition AlignedVector3:51
internal::traits< Derived >::Scalar Scalar
const MatrixSquareRootReturnValue< Derived > sqrt() const
Definition MatrixSquareRoot.h:360
Scalar & coeffRef(Index index)
const Scalar & coeff(Index index) const
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index