11 #ifndef EIGEN_HYPERPLANE_H
12 #define EIGEN_HYPERPLANE_H
14 #include "./InternalHeaderCheck.h"
35 template <
typename Scalar_,
int AmbientDim_,
int Options_>
39 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,AmbientDim_==
Dynamic ?
Dynamic : AmbientDim_+1)
41 AmbientDimAtCompileTime = AmbientDim_,
44 typedef Scalar_ Scalar;
57 template<
int OtherOptions>
70 : m_coeffs(n.size()+1)
81 : m_coeffs(n.size()+1)
93 result.
normal() = (p1 - p0).unitOrthogonal();
103 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
VectorType, 3)
106 result.
normal() = v0.cross(v1);
107 RealScalar norm = result.
normal().norm();
127 normal() = parametrized.direction().unitOrthogonal();
134 EIGEN_DEVICE_FUNC
inline Index dim()
const {
return AmbientDimAtCompileTime==
Dynamic ? m_coeffs.size()-1 :
Index(AmbientDimAtCompileTime); }
139 m_coeffs /=
normal().norm();
169 EIGEN_DEVICE_FUNC
inline const Scalar&
offset()
const {
return m_coeffs.
coeff(
dim()); }
173 EIGEN_DEVICE_FUNC
inline Scalar&
offset() {
return m_coeffs(
dim()); }
193 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
VectorType, 2)
197 if(internal::isMuchSmallerThan(det, Scalar(1)))
199 if(numext::abs(
coeffs().coeff(1))>numext::abs(
coeffs().coeff(0)))
206 Scalar invdet = Scalar(1) / det;
218 template<
typename XprType>
224 m_coeffs /=
normal().norm();
230 eigen_assert(0 &&
"invalid traits value in Hyperplane::transform()");
242 template<
int TrOptions>
256 template<
typename NewScalarType>
257 EIGEN_DEVICE_FUNC
inline typename internal::cast_return_type<
Hyperplane,
260 return typename internal::cast_return_type<
Hyperplane,
265 template<
typename OtherScalarType,
int OtherOptions>
267 { m_coeffs = other.
coeffs().template cast<Scalar>(); }
273 template<
int OtherOptions>
275 {
return m_coeffs.isApprox(other.m_coeffs, prec); }
279 Coefficients m_coeffs;
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:107
TransposeReturnType transpose()
Definition: Transpose.h:184
A hyperplane.
Definition: Hyperplane.h:37
static Hyperplane Through(const VectorType &p0, const VectorType &p1)
Definition: Hyperplane.h:90
VectorType intersection(const Hyperplane &other) const
Definition: Hyperplane.h:191
ConstNormalReturnType normal() const
Definition: Hyperplane.h:159
Hyperplane & transform(const Transform< Scalar, AmbientDimAtCompileTime, Affine, TrOptions > &t, TransformTraits traits=Affine)
Definition: Hyperplane.h:243
Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:145
internal::cast_return_type< Hyperplane, Hyperplane< NewScalarType, AmbientDimAtCompileTime, Options > >::type cast() const
Definition: Hyperplane.h:258
Hyperplane(const VectorType &n, const VectorType &e)
Definition: Hyperplane.h:69
NormalReturnType normal()
Definition: Hyperplane.h:164
Scalar & offset()
Definition: Hyperplane.h:173
Hyperplane()
Definition: Hyperplane.h:55
const Scalar & offset() const
Definition: Hyperplane.h:169
Index dim() const
Definition: Hyperplane.h:134
Scalar absDistance(const VectorType &p) const
Definition: Hyperplane.h:150
static Hyperplane Through(const VectorType &p0, const VectorType &p1, const VectorType &p2)
Definition: Hyperplane.h:101
Hyperplane(const VectorType &n, const Scalar &d)
Definition: Hyperplane.h:80
bool isApprox(const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Hyperplane.h:274
Hyperplane(const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &other)
Definition: Hyperplane.h:266
Coefficients & coeffs()
Definition: Hyperplane.h:183
void normalize(void)
Definition: Hyperplane.h:137
const Coefficients & coeffs() const
Definition: Hyperplane.h:178
Hyperplane(Index _dim)
Definition: Hyperplane.h:64
Hyperplane(const ParametrizedLine< Scalar, AmbientDimAtCompileTime > ¶metrized)
Definition: Hyperplane.h:125
VectorType projection(const VectorType &p) const
Definition: Hyperplane.h:154
Eigen::Index Index
Definition: Hyperplane.h:46
Hyperplane & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
Definition: Hyperplane.h:219
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: JacobiSVD.h:514
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
const Inverse< Derived > inverse() const
Definition: InverseImpl.h:350
A parametrized line.
Definition: ParametrizedLine.h:33
const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:164
const MatrixVType & matrixV() const
Definition: SVDBase.h:191
TransformTraits
Definition: Constants.h:457
@ ComputeFullV
Definition: Constants.h:399
@ Affine
Definition: Constants.h:462
@ Isometry
Definition: Constants.h:459
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59
const int Dynamic
Definition: Constants.h:24
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:231