MOAB
4.9.3pre
|
A hyperplane. More...
#include <Hyperplane.h>
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.
_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 an hyperplane as the zero set of the implicit equation where
is a unit normal vector of the plane (linear part) and
is the distance (offset) to the origin.
Definition at line 34 of file Hyperplane.h.
typedef Matrix<Scalar,Index(AmbientDimAtCompileTime)==Dynamic ? Dynamic : Index(AmbientDimAtCompileTime)+1,1,Options> Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Coefficients |
Definition at line 48 of file Hyperplane.h.
typedef const Block<const Coefficients,AmbientDimAtCompileTime,1> Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::ConstNormalReturnType |
Definition at line 50 of file Hyperplane.h.
typedef Eigen::Index Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Index |
Definition at line 44 of file Hyperplane.h.
typedef Block<Coefficients,AmbientDimAtCompileTime,1> Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::NormalReturnType |
Definition at line 49 of file Hyperplane.h.
typedef NumTraits<Scalar>::Real Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::RealScalar |
Definition at line 43 of file Hyperplane.h.
typedef _Scalar Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Scalar |
Definition at line 42 of file Hyperplane.h.
typedef Matrix<Scalar,AmbientDimAtCompileTime,1> Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::VectorType |
Definition at line 45 of file Hyperplane.h.
anonymous enum |
Definition at line 38 of file Hyperplane.h.
{ AmbientDimAtCompileTime = _AmbientDim, Options = _Options };
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Hyperplane | ( | ) | [inline] |
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Hyperplane | ( | const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > & | other | ) | [inline] |
Definition at line 56 of file Hyperplane.h.
: m_coeffs(other.coeffs()) {}
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Hyperplane | ( | Index | _dim | ) | [inline, explicit] |
Constructs a dynamic-size hyperplane with _dim the dimension of the ambient space
Definition at line 62 of file Hyperplane.h.
: m_coeffs(_dim+1) {}
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.
Definition at line 67 of file Hyperplane.h.
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 .
Definition at line 78 of file Hyperplane.h.
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Hyperplane | ( | const ParametrizedLine< Scalar, AmbientDimAtCompileTime > & | parametrized | ) | [inline, explicit] |
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 123 of file Hyperplane.h.
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::~Hyperplane | ( | ) | [inline] |
Definition at line 129 of file Hyperplane.h.
{}
Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Hyperplane | ( | const Hyperplane< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > & | other | ) | [inline, explicit] |
Copy constructor with scalar type conversion
Definition at line 262 of file Hyperplane.h.
{ m_coeffs = other.coeffs().template cast<Scalar>(); }
Scalar Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::absDistance | ( | const VectorType & | p | ) | const [inline] |
*this
and a point p. Definition at line 148 of file Hyperplane.h.
{ using std::abs; return abs(signedDistance(p)); }
internal::cast_return_type<Hyperplane, Hyperplane<NewScalarType,AmbientDimAtCompileTime,Options> >::type Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::cast | ( | ) | const [inline] |
*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 254 of file Hyperplane.h.
{ return typename internal::cast_return_type<Hyperplane, Hyperplane<NewScalarType,AmbientDimAtCompileTime,Options> >::type(*this); }
const Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::coeffs | ( | ) | const [inline] |
Definition at line 176 of file Hyperplane.h.
{ return m_coeffs; }
Coefficients& Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::coeffs | ( | ) | [inline] |
Definition at line 181 of file Hyperplane.h.
{ return m_coeffs; }
Index Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::dim | ( | ) | const [inline] |
Definition at line 132 of file Hyperplane.h.
{ return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : Index(AmbientDimAtCompileTime); }
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::intersection | ( | const Hyperplane< _Scalar, _AmbientDim, _Options > & | other | ) | const [inline] |
*this
and other are lines.Definition at line 189 of file Hyperplane.h.
{ using std::abs; EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2) Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0); // since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests // whether the two lines are approximately parallel. if(internal::isMuchSmallerThan(det, Scalar(1))) { // special case where the two lines are approximately parallel. Pick any point on the first line. if(abs(coeffs().coeff(1))>abs(coeffs().coeff(0))) return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0)); else return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0)); } else { // general case Scalar invdet = Scalar(1) / det; return VectorType(invdet*(coeffs().coeff(1)*other.coeffs().coeff(2)-other.coeffs().coeff(1)*coeffs().coeff(2)), invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2))); } }
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] |
true
if *this
is approximately equal to other, within the precision determined by prec.Definition at line 270 of file Hyperplane.h.
{ return m_coeffs.isApprox(other.m_coeffs, prec); }
ConstNormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::normal | ( | ) | const [inline] |
Definition at line 157 of file Hyperplane.h.
{ return ConstNormalReturnType(m_coeffs,0,0,dim(),1); }
NormalReturnType Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::normal | ( | ) | [inline] |
Definition at line 162 of file Hyperplane.h.
{ return NormalReturnType(m_coeffs,0,0,dim(),1); }
void Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::normalize | ( | void | ) | [inline] |
const Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::offset | ( | ) | const [inline] |
Definition at line 167 of file Hyperplane.h.
Scalar& Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::offset | ( | ) | [inline] |
Definition at line 171 of file Hyperplane.h.
VectorType Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::projection | ( | const VectorType & | p | ) | const [inline] |
*this
. Definition at line 152 of file Hyperplane.h.
{ return p - signedDistance(p) * normal(); }
Scalar Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::signedDistance | ( | const VectorType & | p | ) | const [inline] |
*this
and a point p. Definition at line 143 of file Hyperplane.h.
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Through | ( | const VectorType & | p0, |
const VectorType & | p1 | ||
) | [inline, static] |
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.
{ Hyperplane result(p0.size()); result.normal() = (p1 - p0).unitOrthogonal(); result.offset() = -p0.dot(result.normal()); return result; }
static Hyperplane Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::Through | ( | const VectorType & | p0, |
const VectorType & | p1, | ||
const VectorType & | p2 | ||
) | [inline, static] |
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.
{ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3) Hyperplane result(p0.size()); VectorType v0(p2 - p0), v1(p1 - p0); result.normal() = v0.cross(v1); RealScalar norm = result.normal().norm(); if(norm <= v0.norm() * v1.norm() * NumTraits<RealScalar>::epsilon()) { Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose(); JacobiSVD<Matrix<Scalar,2,3> > svd(m, ComputeFullV); result.normal() = svd.matrixV().col(2); } else result.normal() /= norm; result.offset() = -p0.dot(result.normal()); return result; }
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
.
mat | the Dim x Dim transformation matrix |
traits | specifies whether the matrix mat represents an Isometry or a more generic Affine transformation. The default is Affine. |
Definition at line 218 of file Hyperplane.h.
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
.
t | the transformation of dimension Dim |
traits | specifies 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 239 of file Hyperplane.h.
Coefficients Eigen::Hyperplane< _Scalar, _AmbientDim, _Options >::m_coeffs [protected] |
Definition at line 275 of file Hyperplane.h.