Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
Eigen::Hyperplane< _Scalar, _AmbientDim > Class Template Reference

A hyperplane. More...

#include <Hyperplane.h>

+ Collaboration diagram for Eigen::Hyperplane< _Scalar, _AmbientDim >:

Public Types

enum  { AmbientDimAtCompileTime = _AmbientDim }
 
enum  { AmbientDimAtCompileTime = _AmbientDim, Options = _Options }
 
typedef _Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
 
typedef Matrix< Scalar, int(AmbientDimAtCompileTime)==Dynamic?Dynamic:int(AmbientDimAtCompileTime)+1, 1 > Coefficients
 
typedef Block< Coefficients, AmbientDimAtCompileTime, 1 > NormalReturnType
 
typedef _Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef DenseIndex Index
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
 
typedef Matrix< Scalar, Index(AmbientDimAtCompileTime)==Dynamic?Dynamic:Index(AmbientDimAtCompileTime)+1, 1, Options > Coefficients
 
typedef Block< Coefficients, AmbientDimAtCompileTime, 1 > NormalReturnType
 
typedef const Block< const Coefficients, AmbientDimAtCompileTime, 1 > ConstNormalReturnType
 

Public Member Functions

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

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)
 
static Hyperplane Through (const VectorType &p0, const VectorType &p1)
 
static Hyperplane Through (const VectorType &p0, const VectorType &p1, const VectorType &p2)
 

Protected Attributes

Coefficients m_coeffs
 

Detailed Description

template<typename _Scalar, int _AmbientDim>
class Eigen::Hyperplane< _Scalar, _AmbientDim >

A hyperplane.

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.

Parameters
_Scalarthe scalar type, i.e., the type of the coefficients
_AmbientDimthe 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 an 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.

Definition at line 33 of file Hyperplane.h.

Constructor & Destructor Documentation

template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( )
inline

Default constructor without initialization

Definition at line 47 of file Hyperplane.h.

47 {}
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( int  _dim)
inlineexplicit

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

Definition at line 51 of file Hyperplane.h.

51 : m_coeffs(_dim+1) {}
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 56 of file Hyperplane.h.

57  : m_coeffs(n.size()+1)
58  {
59  normal() = n;
60  offset() = -e.eigen2_dot(n);
61  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( const VectorType n,
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.

Definition at line 67 of file Hyperplane.h.

68  : m_coeffs(n.size()+1)
69  {
70  normal() = n;
71  offset() = d;
72  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 102 of file Hyperplane.h.

103  {
104  normal() = parametrized.direction().unitOrthogonal();
105  offset() = -normal().eigen2_dot(parametrized.origin());
106  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
template<typename OtherScalarType >
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( const Hyperplane< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 239 of file Hyperplane.h.

240  { m_coeffs = other.coeffs().template cast<Scalar>(); }
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( )
inline

Default constructor without initialization

Definition at line 53 of file Hyperplane.h.

53 {}
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( Index  _dim)
inlineexplicit

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

Definition at line 62 of file Hyperplane.h.

62 : m_coeffs(_dim+1) {}
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 67 of file Hyperplane.h.

68  : m_coeffs(n.size()+1)
69  {
70  normal() = n;
71  offset() = -n.dot(e);
72  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 78 of file Hyperplane.h.

79  : m_coeffs(n.size()+1)
80  {
81  normal() = n;
82  offset() = d;
83  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 113 of file Hyperplane.h.

114  {
115  normal() = parametrized.direction().unitOrthogonal();
116  offset() = -parametrized.origin().dot(normal());
117  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
template<typename OtherScalarType , int OtherOptions>
Eigen::Hyperplane< _Scalar, _AmbientDim >::Hyperplane ( const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 252 of file Hyperplane.h.

253  { m_coeffs = other.coeffs().template cast<Scalar>(); }

Member Function Documentation

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

Definition at line 127 of file Hyperplane.h.

127 { return ei_abs(signedDistance(p)); }
Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:122
template<typename _Scalar, int _AmbientDim>
Scalar Eigen::Hyperplane< _Scalar, _AmbientDim >::absDistance ( const VectorType p) const
inline
Returns
the absolute distance between the plane *this and a point p.
See also
signedDistance()

Definition at line 138 of file Hyperplane.h.

138 { using std::abs; return abs(signedDistance(p)); }
Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:122
template<typename _Scalar, int _AmbientDim>
template<typename NewScalarType >
internal::cast_return_type<Hyperplane, Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 231 of file Hyperplane.h.

232  {
233  return typename internal::cast_return_type<Hyperplane,
234  Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
235  }
template<typename _Scalar, int _AmbientDim>
template<typename NewScalarType >
internal::cast_return_type<Hyperplane, Hyperplane<NewScalarType,AmbientDimAtCompileTime,Options> >::type Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 244 of file Hyperplane.h.

245  {
246  return typename internal::cast_return_type<Hyperplane,
247  Hyperplane<NewScalarType,AmbientDimAtCompileTime,Options> >::type(*this);
248  }
template<typename _Scalar, int _AmbientDim>
const Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim >::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 $

Definition at line 155 of file Hyperplane.h.

155 { return m_coeffs; }
template<typename _Scalar, int _AmbientDim>
Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim >::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 $

Definition at line 160 of file Hyperplane.h.

160 { return m_coeffs; }
template<typename _Scalar, int _AmbientDim>
const Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim >::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 $

Definition at line 166 of file Hyperplane.h.

166 { return m_coeffs; }
template<typename _Scalar, int _AmbientDim>
Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim >::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 $

Definition at line 171 of file Hyperplane.h.

171 { return m_coeffs; }
template<typename _Scalar, int _AmbientDim>
int Eigen::Hyperplane< _Scalar, _AmbientDim >::dim ( ) const
inline
Returns
the dimension in which the plane holds

Definition at line 111 of file Hyperplane.h.

111 { return int(AmbientDimAtCompileTime)==Dynamic ? m_coeffs.size()-1 : int(AmbientDimAtCompileTime); }
template<typename _Scalar, int _AmbientDim>
Index Eigen::Hyperplane< _Scalar, _AmbientDim >::dim ( ) const
inline
Returns
the dimension in which the plane holds

Definition at line 122 of file Hyperplane.h.

122 { return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : Index(AmbientDimAtCompileTime); }
template<typename _Scalar, int _AmbientDim>
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim >::intersection ( const Hyperplane< _Scalar, _AmbientDim > &  other)
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.

Definition at line 168 of file Hyperplane.h.

169  {
170  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2)
171  Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0);
172  // since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests
173  // whether the two lines are approximately parallel.
174  if(ei_isMuchSmallerThan(det, Scalar(1)))
175  { // special case where the two lines are approximately parallel. Pick any point on the first line.
176  if(ei_abs(coeffs().coeff(1))>ei_abs(coeffs().coeff(0)))
177  return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0));
178  else
179  return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0));
180  }
181  else
182  { // general case
183  Scalar invdet = Scalar(1) / det;
184  return VectorType(invdet*(coeffs().coeff(1)*other.coeffs().coeff(2)-other.coeffs().coeff(1)*coeffs().coeff(2)),
185  invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2)));
186  }
187  }
const Coefficients & coeffs() const
Definition: Hyperplane.h:155
template<typename _Scalar, int _AmbientDim>
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim >::intersection ( const Hyperplane< _Scalar, _AmbientDim > &  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.

Definition at line 179 of file Hyperplane.h.

180  {
181  using std::abs;
182  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2)
183  Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0);
184  // since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests
185  // whether the two lines are approximately parallel.
186  if(internal::isMuchSmallerThan(det, Scalar(1)))
187  { // special case where the two lines are approximately parallel. Pick any point on the first line.
188  if(abs(coeffs().coeff(1))>abs(coeffs().coeff(0)))
189  return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0));
190  else
191  return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0));
192  }
193  else
194  { // general case
195  Scalar invdet = Scalar(1) / det;
196  return VectorType(invdet*(coeffs().coeff(1)*other.coeffs().coeff(2)-other.coeffs().coeff(1)*coeffs().coeff(2)),
197  invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2)));
198  }
199  }
const Coefficients & coeffs() const
Definition: Hyperplane.h:155
template<typename _Scalar, int _AmbientDim>
bool Eigen::Hyperplane< _Scalar, _AmbientDim >::isApprox ( const Hyperplane< _Scalar, _AmbientDim > &  other,
typename NumTraits< Scalar >::Real  prec = precision<Scalar>() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 246 of file Hyperplane.h.

247  { return m_coeffs.isApprox(other.m_coeffs, prec); }
template<typename _Scalar, int _AmbientDim>
template<int OtherOptions>
bool Eigen::Hyperplane< _Scalar, _AmbientDim >::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.
See also
MatrixBase::isApprox()

Definition at line 260 of file Hyperplane.h.

261  { return m_coeffs.isApprox(other.m_coeffs, prec); }
template<typename _Scalar, int _AmbientDim>
const NormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 136 of file Hyperplane.h.

136 { return NormalReturnType(*const_cast<Coefficients*>(&m_coeffs),0,0,dim(),1); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
NormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 141 of file Hyperplane.h.

141 { return NormalReturnType(m_coeffs,0,0,dim(),1); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
ConstNormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 147 of file Hyperplane.h.

147 { return ConstNormalReturnType(m_coeffs,0,0,dim(),1); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
NormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 152 of file Hyperplane.h.

152 { return NormalReturnType(m_coeffs,0,0,dim(),1); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
void Eigen::Hyperplane< _Scalar, _AmbientDim >::normalize ( void  )
inline

normalizes *this

Definition at line 114 of file Hyperplane.h.

115  {
116  m_coeffs /= normal().norm();
117  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
template<typename _Scalar, int _AmbientDim>
void Eigen::Hyperplane< _Scalar, _AmbientDim >::normalize ( void  )
inline

normalizes *this

Definition at line 125 of file Hyperplane.h.

126  {
127  m_coeffs /= normal().norm();
128  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
template<typename _Scalar, int _AmbientDim>
const Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 146 of file Hyperplane.h.

146 { return m_coeffs.coeff(dim()); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim >::offset ( )
inline
Returns
a non-constant reference to the distance to the origin, which is also the constant part of the implicit equation

Definition at line 150 of file Hyperplane.h.

150 { return m_coeffs(dim()); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
const Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 157 of file Hyperplane.h.

157 { return m_coeffs.coeff(dim()); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim >::offset ( )
inline
Returns
a non-constant reference to the distance to the origin, which is also the constant part of the implicit equation

Definition at line 161 of file Hyperplane.h.

161 { return m_coeffs(dim()); }
int dim() const
Definition: Hyperplane.h:111
template<typename _Scalar, int _AmbientDim>
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim >::projection ( const VectorType p) const
inline
Returns
the projection of a point p onto the plane *this.

Definition at line 131 of file Hyperplane.h.

131 { return p - signedDistance(p) * normal(); }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:122
template<typename _Scalar, int _AmbientDim>
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim >::projection ( const VectorType p) const
inline
Returns
the projection of a point p onto the plane *this.

Definition at line 142 of file Hyperplane.h.

142 { return p - signedDistance(p) * normal(); }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:122
template<typename _Scalar, int _AmbientDim>
Scalar Eigen::Hyperplane< _Scalar, _AmbientDim >::signedDistance ( const VectorType p) const
inline
Returns
the signed distance between the plane *this and a point p.
See also
absDistance()

Definition at line 122 of file Hyperplane.h.

122 { return p.eigen2_dot(normal()) + offset(); }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
Scalar Eigen::Hyperplane< _Scalar, _AmbientDim >::signedDistance ( const VectorType p) const
inline
Returns
the signed distance between the plane *this and a point p.
See also
absDistance()

Definition at line 133 of file Hyperplane.h.

133 { return normal().dot(p) + offset(); }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 77 of file Hyperplane.h.

78  {
79  Hyperplane result(p0.size());
80  result.normal() = (p1 - p0).unitOrthogonal();
81  result.offset() = -result.normal().eigen2_dot(p0);
82  return result;
83  }
template<typename _Scalar, int _AmbientDim>
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 88 of file Hyperplane.h.

89  {
90  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
91  Hyperplane result(p0.size());
92  result.normal() = (p2 - p0).cross(p1 - p0).normalized();
93  result.offset() = -result.normal().eigen2_dot(p0);
94  return result;
95  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 88 of file Hyperplane.h.

89  {
90  Hyperplane result(p0.size());
91  result.normal() = (p1 - p0).unitOrthogonal();
92  result.offset() = -p0.dot(result.normal());
93  return result;
94  }
template<typename _Scalar, int _AmbientDim>
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 99 of file Hyperplane.h.

100  {
101  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
102  Hyperplane result(p0.size());
103  result.normal() = (p2 - p0).cross(p1 - p0).normalized();
104  result.offset() = -p0.dot(result.normal());
105  return result;
106  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
template<typename XprType >
Hyperplane& Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 196 of file Hyperplane.h.

197  {
198  if (traits==Affine)
199  normal() = mat.inverse().transpose() * normal();
200  else if (traits==Isometry)
201  normal() = mat * normal();
202  else
203  {
204  ei_assert("invalid traits value in Hyperplane::transform()");
205  }
206  return *this;
207  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
template<typename _Scalar, int _AmbientDim>
template<typename XprType >
Hyperplane& Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 208 of file Hyperplane.h.

209  {
210  if (traits==Affine)
211  normal() = mat.inverse().transpose() * normal();
212  else if (traits==Isometry)
213  normal() = mat * normal();
214  else
215  {
216  eigen_assert(0 && "invalid traits value in Hyperplane::transform()");
217  }
218  return *this;
219  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
template<typename _Scalar, int _AmbientDim>
Hyperplane& Eigen::Hyperplane< _Scalar, _AmbientDim >::transform ( const Transform< Scalar, AmbientDimAtCompileTime > &  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.

Definition at line 216 of file Hyperplane.h.

218  {
219  transform(t.linear(), traits);
220  offset() -= t.translation().eigen2_dot(normal());
221  return *this;
222  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
Hyperplane & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
Definition: Hyperplane.h:196
const Scalar & offset() const
Definition: Hyperplane.h:146
template<typename _Scalar, int _AmbientDim>
template<int TrOptions>
Hyperplane& Eigen::Hyperplane< _Scalar, _AmbientDim >::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.

Definition at line 229 of file Hyperplane.h.

231  {
232  transform(t.linear(), traits);
233  offset() -= normal().dot(t.translation());
234  return *this;
235  }
const NormalReturnType normal() const
Definition: Hyperplane.h:136
Hyperplane & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
Definition: Hyperplane.h:196
const Scalar & offset() const
Definition: Hyperplane.h:146

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