11 #ifndef EIGEN_PARAMETRIZEDLINE_H
12 #define EIGEN_PARAMETRIZEDLINE_H
29 template <
typename _Scalar,
int _AmbientDim,
int _Options>
33 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
35 AmbientDimAtCompileTime = _AmbientDim,
38 typedef _Scalar Scalar;
40 typedef DenseIndex Index;
46 template<
int OtherOptions>
48 : m_origin(other.origin()), m_direction(other.direction())
59 : m_origin(origin), m_direction(direction) {}
61 template <
int OtherOptions>
71 inline Index
dim()
const {
return m_direction.size(); }
73 const VectorType& origin()
const {
return m_origin; }
74 VectorType& origin() {
return m_origin; }
76 const VectorType& direction()
const {
return m_direction; }
77 VectorType& direction() {
return m_direction; }
85 return (diff - direction().dot(diff) * direction()).squaredNorm();
94 {
return origin() + direction().dot(p-origin()) * direction(); }
96 VectorType
pointAt(
const Scalar& t)
const;
98 template <
int OtherOptions>
101 template <
int OtherOptions>
104 template <
int OtherOptions>
112 template<
typename NewScalarType>
121 template<
typename OtherScalarType,
int OtherOptions>
124 m_origin = other.origin().template cast<Scalar>();
125 m_direction = other.direction().template cast<Scalar>();
133 {
return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec); }
137 VectorType m_origin, m_direction;
144 template <
typename _Scalar,
int _AmbientDim,
int _Options>
145 template <
int OtherOptions>
148 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
VectorType, 2)
149 direction() = hyperplane.
normal().unitOrthogonal();
155 template <
typename _Scalar,
int _AmbientDim,
int _Options>
159 return origin() + (direction()*t);
164 template <
typename _Scalar,
int _AmbientDim,
int _Options>
165 template <
int OtherOptions>
168 return -(hyperplane.
offset()+hyperplane.
normal().dot(origin()))
169 / hyperplane.
normal().dot(direction());
176 template <
typename _Scalar,
int _AmbientDim,
int _Options>
177 template <
int OtherOptions>
180 return intersectionParameter(hyperplane);
185 template <
typename _Scalar,
int _AmbientDim,
int _Options>
186 template <
int OtherOptions>
190 return pointAt(intersectionParameter(hyperplane));
195 #endif // EIGEN_PARAMETRIZEDLINE_H