Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ > Class Template Reference

A hyperplane. More...

#include <Hyperplane.h>

Public Types

typedef Scalar_ Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef Eigen::Index 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

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

Static Public Member Functions

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

Protected Attributes

Coefficients m_coeffs
 

Detailed Description

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

A hyperplane.

\geometry_module

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 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.

Member Typedef Documentation

◆ Coefficients

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef Matrix<Scalar, Index(AmbientDimAtCompileTime) == Dynamic ? Dynamic : Index(AmbientDimAtCompileTime) + 1, 1, Options> Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Coefficients

◆ ConstNormalReturnType

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef const Block<const Coefficients, AmbientDimAtCompileTime, 1> Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::ConstNormalReturnType

◆ Index

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef Eigen::Index Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Index
Deprecated:
since Eigen 3.3

◆ NormalReturnType

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef Block<Coefficients, AmbientDimAtCompileTime, 1> Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::NormalReturnType

◆ RealScalar

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef NumTraits<Scalar>::Real Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::RealScalar

◆ Scalar

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

◆ VectorType

template<typename Scalar_ , int AmbientDim_, int Options_>
typedef Matrix<Scalar, AmbientDimAtCompileTime, 1> Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::VectorType

Constructor & Destructor Documentation

◆ Hyperplane() [1/7]

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

Default constructor without initialization

53 {}

Referenced by Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::cast().

◆ Hyperplane() [2/7]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane ( const Hyperplane< Scalar, AmbientDimAtCompileTime, OtherOptions > &  other)
inline
57  : m_coeffs(other.coeffs()) {}
Coefficients m_coeffs
Definition: Hyperplane.h:268

◆ Hyperplane() [3/7]

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

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

61 : m_coeffs(_dim + 1) {}

◆ Hyperplane() [4/7]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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.
66  : m_coeffs(n.size() + 1) {
67  normal() = n;
68  offset() = -n.dot(e);
69  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DEVICE_FUNC const Scalar & offset() const
Definition: Hyperplane.h:159
EIGEN_DEVICE_FUNC ConstNormalReturnType normal() const
Definition: Hyperplane.h:147

References e(), n, Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset().

◆ Hyperplane() [5/7]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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.
75  : m_coeffs(n.size() + 1) {
76  normal() = n;
77  offset() = d;
78  }

References n, Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset().

◆ Hyperplane() [6/7]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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.

115  {
116  normal() = parametrized.direction().unitOrthogonal();
117  offset() = -parametrized.origin().dot(normal());
118  }

References Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::direction(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset(), and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::origin().

◆ ~Hyperplane()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::~Hyperplane ( )
inline
120 {}

◆ Hyperplane() [7/7]

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

Copy constructor with scalar type conversion

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

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::coeffs(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

Member Function Documentation

◆ absDistance()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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()
138 { return numext::abs(signedDistance(p)); }
float * p
Definition: Tutorial_Map_using.cpp:9
EIGEN_DEVICE_FUNC Scalar signedDistance(const VectorType &p) const
Definition: Hyperplane.h:133
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE std::enable_if_t< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real > abs(const T &x)
Definition: MathFunctions.h:1355

References Eigen::numext::abs(), p, and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::signedDistance().

◆ cast()

template<typename Scalar_ , int AmbientDim_, int Options_>
template<typename NewScalarType >
EIGEN_DEVICE_FUNC 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.

243  {
244  return
245  typename internal::cast_return_type<Hyperplane,
246  Hyperplane<NewScalarType, AmbientDimAtCompileTime, Options> >::type(*this);
247  }
EIGEN_DEVICE_FUNC Hyperplane()
Definition: Hyperplane.h:53
type
Definition: compute_granudrum_aor.py:141

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane(), and compute_granudrum_aor::type.

◆ coeffs() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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 \)
173 { return m_coeffs; }

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

◆ coeffs() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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 \)
168 { return m_coeffs; }

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

Referenced by Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::Hyperplane(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::intersection().

◆ dim()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC Index Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::dim ( ) const
inline
Returns
the dimension in which the plane holds
123  {
124  return AmbientDimAtCompileTime == Dynamic ? m_coeffs.size() - 1 : Index(AmbientDimAtCompileTime);
125  }
Eigen::Index Index
Definition: Hyperplane.h:44
const int Dynamic
Definition: Constants.h:25

References Eigen::Dynamic, and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

Referenced by Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset().

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE()

template<typename Scalar_ , int AmbientDim_, int Options_>
Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE ( Scalar_  ,
AmbientDim_  = Dynamic ? Dynamic : AmbientDim_ + 1 
)
inline
40  : AmbientDim_ + 1)
41  enum { AmbientDimAtCompileTime = AmbientDim_, Options = Options_ };

◆ intersection()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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.
181  {
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))) { // special case where the two lines are approximately parallel.
187  // Pick any point on the first line.
188  if (numext::abs(coeffs().coeff(1)) > numext::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  } else { // general case
193  Scalar invdet = Scalar(1) / det;
194  return VectorType(
195  invdet * (coeffs().coeff(1) * other.coeffs().coeff(2) - other.coeffs().coeff(1) * coeffs().coeff(2)),
196  invdet * (other.coeffs().coeff(0) * coeffs().coeff(2) - coeffs().coeff(0) * other.coeffs().coeff(2)));
197  }
198  }
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:50
SCALAR Scalar
Definition: bench_gemm.cpp:45
EIGEN_DEVICE_FUNC const Coefficients & coeffs() const
Definition: Hyperplane.h:168
Scalar_ Scalar
Definition: Hyperplane.h:41
Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
Definition: Hyperplane.h:45
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
if(UPLO(*uplo)==INVALID) info
Definition: level3_impl.h:428
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
Definition: Eigen_Colamd.h:49
Definition: fft_test_shared.h:66

References Eigen::numext::abs(), Eigen::PlainObjectBase< Derived >::coeff(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::coeffs(), EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE, and Eigen::internal::isMuchSmallerThan().

◆ isApprox()

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC 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.
See also
MatrixBase::isApprox()
263  {
264  return m_coeffs.isApprox(other.m_coeffs, prec);
265  }

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

◆ normal() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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.
154 { return NormalReturnType(m_coeffs, 0, 0, dim(), 1); }
EIGEN_DEVICE_FUNC Index dim() const
Definition: Hyperplane.h:123
Block< Coefficients, AmbientDimAtCompileTime, 1 > NormalReturnType
Definition: Hyperplane.h:49

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::dim(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

◆ normal() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC ConstNormalReturnType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal ( ) const
inline

◆ normalize()

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

◆ offset() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC 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
163 { return m_coeffs(dim()); }

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::dim(), and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs.

◆ offset() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC const Scalar& Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset ( ) const
inline

◆ projection()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC VectorType Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::projection ( const VectorType p) const
inline
Returns
the projection of a point p onto the plane *this.
142 { return p - signedDistance(p) * normal(); }

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), p, and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::signedDistance().

◆ signedDistance()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC Scalar Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::signedDistance ( const VectorType p) const
inline

◆ Through() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
static EIGEN_DEVICE_FUNC 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.

83  {
84  Hyperplane result(p0.size());
85  result.normal() = (p1 - p0).unitOrthogonal();
86  result.offset() = -p0.dot(result.normal());
87  return result;
88  }
Vector3f p0
Definition: MatrixBase_all.cpp:2
Vector3f p1
Definition: MatrixBase_all.cpp:2

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset(), p0, and p1.

◆ Through() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
static EIGEN_DEVICE_FUNC 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.

93  {
95  Hyperplane result(p0.size());
96  VectorType v0(p2 - p0), v1(p1 - p0);
97  result.normal() = v0.cross(v1);
98  RealScalar norm = result.normal().norm();
99  if (norm <= v0.norm() * v1.norm() * NumTraits<RealScalar>::epsilon()) {
100  Matrix<Scalar, 2, 3> m;
101  m << v0.transpose(), v1.transpose();
102  JacobiSVD<Matrix<Scalar, 2, 3>, ComputeFullV> svd(m);
103  result.normal() = svd.matrixV().col(2);
104  } else
105  result.normal() /= norm;
106  result.offset() = -p0.dot(result.normal());
107  return result;
108  }
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf, ComputeThinU|ComputeThinV > svd(m)
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
@ ComputeFullV
Definition: Constants.h:393
int * m
Definition: level2_cplx_impl.h:294
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
void cross(const Vector< double > &A, const Vector< double > &B, Vector< double > &C)
Definition: oomph-lib/src/generic/Vector.h:319

References Eigen::ComputeFullV, EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE, m, Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset(), p0, p1, svd(), and v1().

◆ transform() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<typename XprType >
EIGEN_DEVICE_FUNC 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.
207  {
208  if (traits == Affine) {
209  normal() = mat.inverse().transpose() * normal();
210  m_coeffs /= normal().norm();
211  } else if (traits == Isometry)
212  normal() = mat * normal();
213  else {
214  eigen_assert(0 && "invalid traits value in Hyperplane::transform()");
215  }
216  return *this;
217  }
#define eigen_assert(x)
Definition: Macros.h:910
TransposeReturnType transpose()
Definition: SparseMatrixBase.h:358
@ Affine
Definition: Constants.h:458
@ Isometry
Definition: Constants.h:455

References Eigen::Affine, eigen_assert, Eigen::Isometry, Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::m_coeffs, Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), and Eigen::SparseMatrixBase< Derived >::transpose().

Referenced by Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::transform().

◆ transform() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int TrOptions>
EIGEN_DEVICE_FUNC 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.
228  {
229  transform(t.linear(), traits);
230  offset() -= normal().dot(t.translation());
231  return *this;
232  }
EIGEN_DEVICE_FUNC Hyperplane & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
Definition: Hyperplane.h:207
t
Definition: plotPSD.py:36

References Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::normal(), Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::offset(), plotPSD::t, and Eigen::Hyperplane< Scalar_, AmbientDim_, Options_ >::transform().

Member Data Documentation

◆ m_coeffs


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