Eigen  5.0.1
 
Loading...
Searching...
No Matches
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ > Class Template Reference

#include <Eigen/src/Geometry/Hyperplane.h>

Detailed Description

template<typename Scalar_, int AmbientDim_, int Options_>
class Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >

A hyperplane.

This is defined in the Geometry module.

#include <Eigen/Geometry>

A hyperplane is an affine subspace of dimension n-1 in a space of dimension n. For example, a hyperplane in a plane is a line; a hyperplane in 3-space is a plane.

Template Parameters
Scalar_the scalar type, i.e., the type of the coefficients
AmbientDim_the dimension of the ambient space, can be a compile time value or Dynamic. Notice that the dimension of the hyperplane is AmbientDim_-1.

This class represents a hyperplane as the zero set of the implicit equation \( n \cdot x + d = 0 \) where \( n \) is a unit normal vector of the plane (linear part) and \( d \) is the distance (offset) to the origin.

Public Types

using Index
 

Public Member Functions

Scalar absDistance (const VectorType &p) const
 
template<typename NewScalarType>
internal::cast_return_type< Hyperplane, Hyperplane< NewScalarType, AmbientDimAtCompileTime, Options > >::type cast () const
 
Coefficients & coeffs ()
 
const Coefficients & coeffs () const
 
Index dim () const
 
 Hyperplane ()
 
template<typename OtherScalarType, int OtherOptions>
 Hyperplane (const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &other)
 
 Hyperplane (const ParametrizedLine< Scalar, AmbientDimAtCompileTime > &parametrized)
 
 Hyperplane (const VectorType &n, const Scalar &d)
 
 Hyperplane (const VectorType &n, const VectorType &e)
 
 Hyperplane (Index _dim)
 
VectorType intersection (const Hyperplane &other) const
 
template<int OtherOptions>
bool isApprox (const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<int OtherOptions>
bool isCoincident (const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
NormalReturnType normal ()
 
ConstNormalReturnType normal () const
 
void normalize (void)
 
Scalar & offset ()
 
const Scalar & offset () const
 
VectorType projection (const VectorType &p) const
 
Scalar signedDistance (const VectorType &p) const
 
template<typename XprType>
Hyperplane & transform (const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
 
template<int TrOptions>
Hyperplane & transform (const Transform< Scalar, AmbientDimAtCompileTime, Affine, TrOptions > &t, TransformTraits traits=Affine)
 

Static Public Member Functions

static Hyperplane Through (const VectorType &p0, const VectorType &p1)
 
static Hyperplane Through (const VectorType &p0, const VectorType &p1, const VectorType &p2)
 

Member Typedef Documentation

◆ Index

template<typename Scalar_, int AmbientDim_, int Options_>
using Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Index

Constructor & Destructor Documentation

◆ Hyperplane() [1/6]

template<typename Scalar_, int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( )
inline

Default constructor without initialization

◆ Hyperplane() [2/6]

template<typename Scalar_, int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( Index _dim)
inlineexplicit

Constructs a dynamic-size hyperplane with _dim the dimension of the ambient space

◆ Hyperplane() [3/6]

template<typename Scalar_, int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( const VectorType & n,
const VectorType & e )
inline

Construct a plane from its normal n and a point e onto the plane.

Warning
the vector normal is assumed to be normalized.

◆ Hyperplane() [4/6]

template<typename Scalar_, int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( const VectorType & n,
const Scalar & d )
inline

Constructs a plane from its normal n and distance to the origin d such that the algebraic equation of the plane is \( n \cdot x + d = 0 \).

Warning
the vector normal is assumed to be normalized.

◆ Hyperplane() [5/6]

template<typename Scalar_, int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( const ParametrizedLine< Scalar, AmbientDimAtCompileTime > & parametrized)
inlineexplicit

Constructs a hyperplane passing through the parametrized line parametrized. If the dimension of the ambient space is greater than 2, then there isn't uniqueness, so an arbitrary choice is made.

◆ Hyperplane() [6/6]

template<typename Scalar_, int AmbientDim_, int Options_>
template<typename OtherScalarType, int OtherOptions>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > & other)
inlineexplicit

Copy constructor with scalar type conversion

Member Function Documentation

◆ absDistance()

template<typename Scalar_, int AmbientDim_, int Options_>
Scalar Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::absDistance ( const VectorType & p) const
inline
Returns
the absolute distance between the plane *this and a point p.
See also
signedDistance()

◆ cast()

template<typename Scalar_, int AmbientDim_, int Options_>
template<typename NewScalarType>
internal::cast_return_type< Hyperplane, Hyperplane< NewScalarType, AmbientDimAtCompileTime, Options > >::type Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::cast ( ) const
inline
Returns
*this with scalar type casted to NewScalarType

Note that if NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.

◆ coeffs() [1/2]

template<typename Scalar_, int AmbientDim_, int Options_>
Coefficients & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::coeffs ( )
inline
Returns
a non-constant reference to the coefficients c_i of the plane equation: \( c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \)

◆ coeffs() [2/2]

template<typename Scalar_, int AmbientDim_, int Options_>
const Coefficients & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::coeffs ( ) const
inline
Returns
a constant reference to the coefficients c_i of the plane equation: \( c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \)

◆ dim()

template<typename Scalar_, int AmbientDim_, int Options_>
Index Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::dim ( ) const
inline
Returns
the dimension in which the plane holds

◆ intersection()

template<typename Scalar_, int AmbientDim_, int Options_>
VectorType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::intersection ( const Hyperplane< Scalar_, AmbientDim_, Options_ > & other) const
inline
Returns
the intersection of *this with other.
Warning
The ambient space must be a plane, i.e. have dimension 2, so that *this and other are lines.
Note
If other is approximately parallel to *this, this method will return any point on *this.

◆ isApprox()

template<typename Scalar_, int AmbientDim_, int Options_>
template<int OtherOptions>
bool Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::isApprox ( const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > & other,
const typename NumTraits< Scalar >::Real & prec = NumTraits<Scalar>::dummy_precision() ) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.

Hyperplanes are oriented: the sign of their coefficients decides which side signedDistance() reports as positive, so a hyperplane and its negation are not approximately equal here even though they describe the same point set. Use isCoincident() to compare them as point sets.

See also
isCoincident(), MatrixBase::isApprox()

◆ isCoincident()

template<typename Scalar_, int AmbientDim_, int Options_>
template<int OtherOptions>
bool Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::isCoincident ( const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > & other,
const typename NumTraits< Scalar >::Real & prec = NumTraits<Scalar>::dummy_precision() ) const
inline
Returns
true if *this and other describe approximately the same set of points, within the precision determined by prec, regardless of orientation and scale.

Scaling the equation signedDistance() evaluates by any nonzero \( \gamma \) leaves its zero set unchanged. Because dot() is conjugate-linear in the normal, that carries \( (n, d) \) to \( (\bar{\gamma} n, \gamma d) \), so coincident hyperplanes need not have coefficients of equal magnitude: for a real Scalar any nonzero real factor relates them, a sign flip - which isApprox() rejects - being the norm-preserving case, and for a complex Scalar any nonzero complex factor does.

The comparison is therefore made on the normalized equations, which \( \gamma \) no longer distinguishes beyond a unit-modulus factor: the unit normals must agree, up to that factor, within prec, and the two distances to the origin must agree the way internal::isApprox() compares scalars, that is relative to their own magnitude. Comparing the two halves separately is what keeps a distant hyperplane from relaxing the comparison of the normals; it also means that a hyperplane through the origin is not coincident with one that merely passes close to it. The result is symmetric in the two hyperplanes, and unchanged both when either equation is rescaled and when the ambient coordinates are.

Both normals must be nonzero.

See also
isApprox(), signedDistance(), normalize()

◆ normal() [1/2]

template<typename Scalar_, int AmbientDim_, int Options_>
NormalReturnType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal ( )
inline
Returns
a non-constant reference to the unit normal vector of the plane, which corresponds to the linear part of the implicit equation.

◆ normal() [2/2]

template<typename Scalar_, int AmbientDim_, int Options_>
ConstNormalReturnType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal ( ) const
inline
Returns
a constant reference to the unit normal vector of the plane, which corresponds to the linear part of the implicit equation.

◆ normalize()

template<typename Scalar_, int AmbientDim_, int Options_>
void Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normalize ( void )
inline

normalizes *this

◆ offset() [1/2]

template<typename Scalar_, int AmbientDim_, int Options_>
Scalar & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset ( )
inline
Returns
a non-constant reference to the distance to the origin, which is also the constant part of the implicit equation

◆ offset() [2/2]

template<typename Scalar_, int AmbientDim_, int Options_>
const Scalar & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset ( ) const
inline
Returns
the distance to the origin, which is also the "constant term" of the implicit equation
Warning
the vector normal is assumed to be normalized.

◆ projection()

template<typename Scalar_, int AmbientDim_, int Options_>
VectorType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::projection ( const VectorType & p) const
inline
Returns
the projection of a point p onto the plane *this.

◆ signedDistance()

template<typename Scalar_, int AmbientDim_, int Options_>
Scalar Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::signedDistance ( const VectorType & p) const
inline
Returns
the signed distance between the plane *this and a point p.
See also
absDistance()

◆ Through() [1/2]

template<typename Scalar_, int AmbientDim_, int Options_>
static Hyperplane Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Through ( const VectorType & p0,
const VectorType & p1 )
inlinestatic

Constructs a hyperplane passing through the two points. If the dimension of the ambient space is greater than 2, then there isn't uniqueness, so an arbitrary choice is made.

◆ Through() [2/2]

template<typename Scalar_, int AmbientDim_, int Options_>
static Hyperplane Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Through ( const VectorType & p0,
const VectorType & p1,
const VectorType & p2 )
inlinestatic

Constructs a hyperplane passing through the three points. The dimension of the ambient space is required to be exactly 3.

◆ transform() [1/2]

template<typename Scalar_, int AmbientDim_, int Options_>
template<typename XprType>
Hyperplane & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::transform ( const MatrixBase< XprType > & mat,
TransformTraits traits = Affine )
inline

Applies the transformation matrix mat to *this and returns a reference to *this.

Parameters
matthe Dim x Dim transformation matrix
traitsspecifies whether the matrix mat represents an Isometry or a more generic Affine transformation. The default is Affine.

◆ transform() [2/2]

template<typename Scalar_, int AmbientDim_, int Options_>
template<int TrOptions>
Hyperplane & Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::transform ( const Transform< Scalar, AmbientDimAtCompileTime, Affine, TrOptions > & t,
TransformTraits traits = Affine )
inline

Applies the transformation t to *this and returns a reference to *this.

Parameters
tthe transformation of dimension Dim
traitsspecifies whether the transformation t represents an Isometry or a more generic Affine transformation. The default is Affine. Other kind of transformations are not supported.

The documentation for this class was generated from the following files: