11 #ifndef EIGEN_HYPERPLANE_H 12 #define EIGEN_HYPERPLANE_H 33 template <
typename _Scalar,
int _AmbientDim,
int _Options>
55 template<
int OtherOptions>
67 EIGEN_DEVICE_FUNC
inline Hyperplane(
const VectorType& n,
const VectorType& e)
78 EIGEN_DEVICE_FUNC
inline Hyperplane(
const VectorType& n,
const Scalar& d)
88 EIGEN_DEVICE_FUNC
static inline Hyperplane Through(
const VectorType& p0,
const VectorType& p1)
91 result.
normal() = (p1 - p0).unitOrthogonal();
92 result.offset() = -p0.dot(result.normal());
99 EIGEN_DEVICE_FUNC
static inline Hyperplane Through(
const VectorType& p0,
const VectorType& p1,
const VectorType& p2)
103 VectorType v0(p2 - p0), v1(p1 - p0);
104 result.normal() = v0.cross(v1);
105 RealScalar norm = result.normal().norm();
110 result.normal() = svd.
matrixV().col(2);
113 result.normal() /= norm;
114 result.offset() = -p0.dot(result.normal());
195 if(internal::isMuchSmallerThan(det,
Scalar(1)))
204 Scalar invdet =
Scalar(1) / det;
216 template<
typename XprType>
228 eigen_assert(0 &&
"invalid traits value in Hyperplane::transform()");
240 template<
int TrOptions>
254 template<
typename NewScalarType>
263 template<
typename OtherScalarType,
int OtherOptions>
265 {
m_coeffs = other.coeffs().template cast<Scalar>(); }
271 template<
int OtherOptions>
273 {
return m_coeffs.isApprox(other.m_coeffs, prec); }
282 #endif // EIGEN_HYPERPLANE_H
EIGEN_DEVICE_FUNC Hyperplane & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
EIGEN_DEVICE_FUNC const VectorType & direction() const
Matrix< Scalar, Index(AmbientDimAtCompileTime)==Dynamic?Dynamic:Index(AmbientDimAtCompileTime)+1, 1, Options > Coefficients
EIGEN_DEVICE_FUNC Index dim() const
static EIGEN_DEVICE_FUNC Hyperplane Through(const VectorType &p0, const VectorType &p1)
EIGEN_DEVICE_FUNC Hyperplane(const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &other)
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEVICE_FUNC Hyperplane(const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &other)
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
EIGEN_DEVICE_FUNC Scalar absDistance(const VectorType &p) const
EIGEN_DEVICE_FUNC Hyperplane(const ParametrizedLine< Scalar, AmbientDimAtCompileTime > ¶metrized)
EIGEN_DEVICE_FUNC Hyperplane(Index _dim)
EIGEN_DEVICE_FUNC VectorType intersection(const Hyperplane &other) const
EIGEN_DEVICE_FUNC internal::cast_return_type< Hyperplane, Hyperplane< NewScalarType, AmbientDimAtCompileTime, Options > >::type cast() const
EIGEN_DEVICE_FUNC Hyperplane()
const Block< const Coefficients, AmbientDimAtCompileTime, 1 > ConstNormalReturnType
EIGEN_DEVICE_FUNC const Coefficients & coeffs() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC NormalReturnType normal()
const MatrixVType & matrixV() const
Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
EIGEN_DEVICE_FUNC Hyperplane & transform(const Transform< Scalar, AmbientDimAtCompileTime, Affine, TrOptions > &t, TransformTraits traits=Affine)
EIGEN_DEVICE_FUNC Scalar signedDistance(const VectorType &p) const
EIGEN_DEVICE_FUNC Coefficients & coeffs()
static EIGEN_DEVICE_FUNC Hyperplane Through(const VectorType &p0, const VectorType &p1, const VectorType &p2)
Expression of a fixed-size or dynamic-size block.
EIGEN_DEVICE_FUNC const VectorType & origin() const
EIGEN_DEVICE_FUNC void normalize(void)
Two-sided Jacobi SVD decomposition of a rectangular matrix.
EIGEN_DEVICE_FUNC Hyperplane(const VectorType &n, const VectorType &e)
EIGEN_DEVICE_FUNC ConstNormalReturnType normal() const
EIGEN_DEVICE_FUNC Hyperplane(const VectorType &n, const Scalar &d)
EIGEN_DEVICE_FUNC VectorType projection(const VectorType &p) const
Block< Coefficients, AmbientDimAtCompileTime, 1 > NormalReturnType
EIGEN_DEVICE_FUNC ~Hyperplane()
const Inverse< Derived > inverse() const
Base class for all dense matrices, vectors, and expressions.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
EIGEN_DEVICE_FUNC bool isApprox(const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
EIGEN_DEVICE_FUNC const Scalar & offset() const
EIGEN_DEVICE_FUNC Scalar & offset()