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

A parametrized line. More...

#include <ParametrizedLine.h>

Public Types

enum  { AmbientDimAtCompileTime = AmbientDim_ , Options = Options_ }
 
typedef Scalar_ Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef Eigen::Index Index
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1, OptionsVectorType
 

Public Member Functions

EIGEN_DEVICE_FUNC ParametrizedLine ()
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC ParametrizedLine (const ParametrizedLine< Scalar, AmbientDimAtCompileTime, OtherOptions > &other)
 
EIGEN_DEVICE_FUNC ParametrizedLine (Index _dim)
 
EIGEN_DEVICE_FUNC ParametrizedLine (const VectorType &origin, const VectorType &direction)
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC ParametrizedLine (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane)
 
EIGEN_DEVICE_FUNC ~ParametrizedLine ()
 
EIGEN_DEVICE_FUNC Index dim () const
 
EIGEN_DEVICE_FUNC const VectorTypeorigin () const
 
EIGEN_DEVICE_FUNC VectorTypeorigin ()
 
EIGEN_DEVICE_FUNC const VectorTypedirection () const
 
EIGEN_DEVICE_FUNC VectorTypedirection ()
 
EIGEN_DEVICE_FUNC RealScalar squaredDistance (const VectorType &p) const
 
EIGEN_DEVICE_FUNC RealScalar distance (const VectorType &p) const
 
EIGEN_DEVICE_FUNC VectorType projection (const VectorType &p) const
 
EIGEN_DEVICE_FUNC VectorType pointAt (const Scalar &t) const
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar intersectionParameter (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar intersection (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC VectorType intersectionPoint (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const
 
template<typename XprType >
EIGEN_DEVICE_FUNC ParametrizedLinetransform (const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
 
template<int TrOptions>
EIGEN_DEVICE_FUNC ParametrizedLinetransform (const Transform< Scalar, AmbientDimAtCompileTime, Affine, TrOptions > &t, TransformTraits traits=Affine)
 
template<typename NewScalarType >
EIGEN_DEVICE_FUNC internal::cast_return_type< ParametrizedLine, ParametrizedLine< NewScalarType, AmbientDimAtCompileTime, Options > >::type cast () const
 
template<typename OtherScalarType , int OtherOptions>
EIGEN_DEVICE_FUNC ParametrizedLine (const ParametrizedLine< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &other)
 
EIGEN_DEVICE_FUNC bool isApprox (const ParametrizedLine &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar_ intersectionParameter (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const
 
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar_ intersection (const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const
 

Static Public Member Functions

static EIGEN_DEVICE_FUNC ParametrizedLine Through (const VectorType &p0, const VectorType &p1)
 

Protected Attributes

VectorType m_origin
 
VectorType m_direction
 

Detailed Description

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

A parametrized line.

\geometry_module

A parametrized line is defined by an origin point \( \mathbf{o} \) and a unit direction vector \( \mathbf{d} \) such that the line corresponds to the set \( l(t) = \mathbf{o} + t \mathbf{d} \), \( t \in \mathbf{R} \).

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.

Member Typedef Documentation

◆ Index

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

◆ RealScalar

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

◆ Scalar

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

◆ VectorType

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

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int AmbientDim_, int Options_>
anonymous enum
Enumerator
AmbientDimAtCompileTime 
Options 
36 { AmbientDimAtCompileTime = AmbientDim_, Options = Options_ };
@ AmbientDimAtCompileTime
Definition: ParametrizedLine.h:36
@ Options
Definition: ParametrizedLine.h:36

Constructor & Destructor Documentation

◆ ParametrizedLine() [1/6]

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

◆ ParametrizedLine() [2/6]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::ParametrizedLine ( const ParametrizedLine< Scalar, AmbientDimAtCompileTime, OtherOptions > &  other)
inline
47  : m_origin(other.origin()), m_direction(other.direction()) {}
VectorType m_origin
Definition: ParametrizedLine.h:177
VectorType m_direction
Definition: ParametrizedLine.h:177

◆ ParametrizedLine() [3/6]

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

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

51 : m_origin(_dim), m_direction(_dim) {}

◆ ParametrizedLine() [4/6]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::ParametrizedLine ( const VectorType origin,
const VectorType direction 
)
inline

Initializes a parametrized line of direction direction and origin origin.

Warning
the vector direction is assumed to be normalized.
EIGEN_DEVICE_FUNC const VectorType & direction() const
Definition: ParametrizedLine.h:75
EIGEN_DEVICE_FUNC const VectorType & origin() const
Definition: ParametrizedLine.h:72

◆ ParametrizedLine() [5/6]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::ParametrizedLine ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane)
inlineexplicit

Constructs a parametrized line from a 2D hyperplane

Warning
the ambient space must have dimension 2 such that the hyperplane actually describes a line
187  {
189  direction() = hyperplane.normal().unitOrthogonal();
190  origin() = -hyperplane.normal() * hyperplane.offset();
191 }
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:50
void hyperplane(const HyperplaneType &_plane)
Definition: geo_hyperplane.cpp:17
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
Definition: fft_test_shared.h:66

References EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE, and hyperplane().

◆ ~ParametrizedLine()

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

◆ ParametrizedLine() [6/6]

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

Member Function Documentation

◆ cast()

template<typename Scalar_ , int AmbientDim_, int Options_>
template<typename NewScalarType >
EIGEN_DEVICE_FUNC internal::cast_return_type<ParametrizedLine, ParametrizedLine<NewScalarType, AmbientDimAtCompileTime, Options> >::type Eigen::ParametrizedLine< 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.

154  {
155  return typename internal::cast_return_type<
156  ParametrizedLine, ParametrizedLine<NewScalarType, AmbientDimAtCompileTime, Options> >::type(*this);
157  }
EIGEN_DEVICE_FUNC ParametrizedLine()
Definition: ParametrizedLine.h:43
type
Definition: compute_granudrum_aor.py:141

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

◆ dim()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC Index Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::dim ( ) const
inline
Returns
the dimension in which the line holds
70 { return m_direction.size(); }

References Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::m_direction.

◆ direction() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC VectorType& Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::direction ( void  )
inline

◆ direction() [2/2]

◆ distance()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC RealScalar Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::distance ( const VectorType p) const
inline
Returns
the distance of a point p to its projection onto the line *this.
See also
squaredDistance()
88  {
90  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1090
float * p
Definition: Tutorial_Map_using.cpp:9
EIGEN_DEVICE_FUNC RealScalar squaredDistance(const VectorType &p) const
Definition: ParametrizedLine.h:81

References EIGEN_USING_STD, p, sqrt(), and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::squaredDistance().

◆ intersection() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::intersection ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane) const

◆ intersection() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar_ Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::intersection ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane) const
inline
Deprecated:
use intersectionParameter()
Returns
the parameter value of the intersection between *this and the given hyperplane
216  {
218 }
EIGEN_DEVICE_FUNC Scalar intersectionParameter(const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const

References hyperplane().

◆ intersectionParameter() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::intersectionParameter ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane) const

◆ intersectionParameter() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC Scalar_ Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::intersectionParameter ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane) const
inline
Returns
the parameter value of the intersection between *this and the given hyperplane
206  {
207  return -(hyperplane.offset() + hyperplane.normal().dot(origin())) / hyperplane.normal().dot(direction());
208 }

References hyperplane().

◆ intersectionPoint()

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
EIGEN_DEVICE_FUNC ParametrizedLine< Scalar_, AmbientDim_, Options_ >::VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::intersectionPoint ( const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &  hyperplane) const
inline
Returns
the point of the intersection between *this and the given hyperplane
226  {
228 }
EIGEN_DEVICE_FUNC VectorType pointAt(const Scalar &t) const
Definition: ParametrizedLine.h:197

References hyperplane().

◆ isApprox()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC bool Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::isApprox ( const ParametrizedLine< Scalar_, AmbientDim_, Options_ > &  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()
172  {
173  return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec);
174  }

References Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::m_direction, and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::m_origin.

◆ origin() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC VectorType& Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::origin ( )
inline

◆ origin() [2/2]

◆ pointAt()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC ParametrizedLine< Scalar_, AmbientDim_, Options_ >::VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::pointAt ( const Scalar t) const
inline
Returns
the point at t along this line
197  {
198  return origin() + (direction() * t);
199 }
t
Definition: plotPSD.py:36

References plotPSD::t.

◆ projection()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::projection ( const VectorType p) const
inline
Returns
the projection of a point p onto the line *this.
93  {
94  return origin() + direction().dot(p - origin()) * direction();
95  }

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

◆ squaredDistance()

template<typename Scalar_ , int AmbientDim_, int Options_>
EIGEN_DEVICE_FUNC RealScalar Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::squaredDistance ( const VectorType p) const
inline
Returns
the squared distance of a point p to its projection onto the line *this.
See also
distance()
81  {
82  VectorType diff = p - origin();
83  return (diff - direction().dot(diff) * direction()).squaredNorm();
84  }
Scalar EIGEN_BLAS_FUNC_NAME() dot(int *n, Scalar *px, int *incx, Scalar *py, int *incy)
Definition: level1_real_impl.h:52

References Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::direction(), dot(), Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::origin(), and p.

Referenced by Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::distance().

◆ Through()

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

Constructs a parametrized line going from p0 to p1.

63  {
64  return ParametrizedLine(p0, (p1 - p0).normalized());
65  }
Vector3f p0
Definition: MatrixBase_all.cpp:2
Vector3f p1
Definition: MatrixBase_all.cpp:2

References p0, p1, and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::ParametrizedLine().

◆ transform() [1/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<typename XprType >
EIGEN_DEVICE_FUNC ParametrizedLine& Eigen::ParametrizedLine< 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.
118  {
119  if (traits == Affine)
120  direction() = (mat * direction()).normalized();
121  else if (traits == Isometry)
122  direction() = mat * direction();
123  else {
124  eigen_assert(0 && "invalid traits value in ParametrizedLine::transform()");
125  }
126  origin() = mat * origin();
127  return *this;
128  }
#define eigen_assert(x)
Definition: Macros.h:910
@ Affine
Definition: Constants.h:458
@ Isometry
Definition: Constants.h:455

References Eigen::Affine, Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::direction(), eigen_assert, Eigen::Isometry, and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::origin().

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

◆ transform() [2/2]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int TrOptions>
EIGEN_DEVICE_FUNC ParametrizedLine& Eigen::ParametrizedLine< 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.
139  {
140  transform(t.linear(), traits);
141  origin() += t.translation();
142  return *this;
143  }
EIGEN_DEVICE_FUNC ParametrizedLine & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)
Definition: ParametrizedLine.h:117

References Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::origin(), plotPSD::t, and Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::transform().

Member Data Documentation

◆ m_direction

◆ m_origin


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