11 #ifndef EIGEN_HYPERPLANE_H
12 #define EIGEN_HYPERPLANE_H
33 template <
typename _Scalar,
int _AmbientDim,
int _Options>
37 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
Dynamic ?
Dynamic : _AmbientDim+1)
39 AmbientDimAtCompileTime = _AmbientDim,
42 typedef _Scalar Scalar;
44 typedef DenseIndex Index;
48 : Index(AmbientDimAtCompileTime)+1,1,Options>
Coefficients;
55 template<
int OtherOptions>
62 inline explicit Hyperplane(Index _dim) : m_coeffs(_dim+1) {}
68 : m_coeffs(n.size()+1)
79 : m_coeffs(n.size()+1)
91 result.
normal() = (p1 - p0).unitOrthogonal();
92 result.offset() = -p0.dot(result.normal());
101 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
VectorType, 3)
103 result.
normal() = (p2 - p0).cross(p1 - p0).normalized();
104 result.offset() = -p0.dot(result.normal());
115 normal() = parametrized.direction().unitOrthogonal();
122 inline Index
dim()
const {
return AmbientDimAtCompileTime==
Dynamic ? m_coeffs.size()-1 : Index(AmbientDimAtCompileTime); }
127 m_coeffs /=
normal().norm();
157 inline const Scalar&
offset()
const {
return m_coeffs.coeff(
dim()); }
181 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
VectorType, 2)
185 if(internal::isMuchSmallerThan(det, Scalar(1)))
187 if(internal::abs(
coeffs().coeff(1))>internal::abs(
coeffs().coeff(0)))
194 Scalar invdet = Scalar(1) / det;
206 template<
typename XprType>
215 eigen_assert(0 &&
"invalid traits value in Hyperplane::transform()");
227 template<
int TrOptions>
241 template<
typename NewScalarType>
242 inline typename internal::cast_return_type<
Hyperplane,
245 return typename internal::cast_return_type<
Hyperplane,
250 template<
typename OtherScalarType,
int OtherOptions>
252 { m_coeffs = other.
coeffs().template cast<Scalar>(); }
258 template<
int OtherOptions>
260 {
return m_coeffs.isApprox(other.m_coeffs, prec); }
264 Coefficients m_coeffs;
269 #endif // EIGEN_HYPERPLANE_H