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

A parametrized line. More...

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

VectorType m_direction
 
VectorType m_origin
 

Detailed Description

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

A parametrized line.

This is defined in the 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.

Definition at line 32 of file ParametrizedLine.h.

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

Definition at line 42 of file ParametrizedLine.h.

◆ RealScalar

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

Definition at line 41 of file ParametrizedLine.h.

◆ Scalar

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

Definition at line 40 of file ParametrizedLine.h.

◆ VectorType

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

Definition at line 43 of file ParametrizedLine.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int AmbientDim_, int Options_>
anonymous enum
Enumerator
AmbientDimAtCompileTime 
Options 

Definition at line 36 of file ParametrizedLine.h.

36  {
37  AmbientDimAtCompileTime = AmbientDim_,
38  Options = Options_
39  };

Constructor & Destructor Documentation

◆ ParametrizedLine() [1/6]

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

Default constructor without initialization

Definition at line 46 of file ParametrizedLine.h.

46 {}

◆ ParametrizedLine() [2/6]

template<typename Scalar_ , int AmbientDim_, int Options_>
template<int OtherOptions>
Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::ParametrizedLine ( const ParametrizedLine< Scalar, AmbientDimAtCompileTime, OtherOptions > &  other)
inline

Definition at line 49 of file ParametrizedLine.h.

50  : m_origin(other.origin()), m_direction(other.direction())
51  {}

◆ ParametrizedLine() [3/6]

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

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

Definition at line 55 of file ParametrizedLine.h.

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

◆ ParametrizedLine() [4/6]

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

Definition at line 60 of file ParametrizedLine.h.

const VectorType & direction() const
const VectorType & origin() const

◆ ParametrizedLine() [5/6]

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

Definition at line 185 of file ParametrizedLine.h.

186 {
188  direction() = hyperplane.normal().unitOrthogonal();
189  origin() = -hyperplane.normal()*hyperplane.offset();
190 }
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:51
Matrix< Scalar, AmbientDimAtCompileTime, 1, Options > VectorType

◆ ~ParametrizedLine()

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

Definition at line 70 of file ParametrizedLine.h.

70 {}

◆ ParametrizedLine() [6/6]

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

Copy constructor with scalar type conversion

Definition at line 161 of file ParametrizedLine.h.

162  {
163  m_origin = other.origin().template cast<Scalar>();
164  m_direction = other.direction().template cast<Scalar>();
165  }

Member Function Documentation

◆ cast()

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

Definition at line 153 of file ParametrizedLine.h.

154  {
155  return typename internal::cast_return_type<ParametrizedLine,
156  ParametrizedLine<NewScalarType,AmbientDimAtCompileTime,Options> >::type(*this);
157  }

◆ dim()

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

Definition at line 73 of file ParametrizedLine.h.

73 { return m_direction.size(); }

◆ direction() [1/2]

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

Definition at line 79 of file ParametrizedLine.h.

79 { return m_direction; }

◆ direction() [2/2]

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

Definition at line 78 of file ParametrizedLine.h.

78 { return m_direction; }

◆ distance()

template<typename Scalar_ , int AmbientDim_, int Options_>
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()

Definition at line 92 of file ParametrizedLine.h.

#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1080
float * p
RealScalar squaredDistance(const VectorType &p) const
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(const Eigen::ArrayBase< Derived > &x)

◆ intersection() [1/2]

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

Definition at line 217 of file ParametrizedLine.h.

218 {
219  return intersectionParameter(hyperplane);
220 }
Scalar intersectionParameter(const Hyperplane< Scalar_, AmbientDim_, OtherOptions > &hyperplane) const

◆ intersectionParameter() [1/2]

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

Definition at line 205 of file ParametrizedLine.h.

206 {
207  return -(hyperplane.offset()+hyperplane.normal().dot(origin()))
208  / hyperplane.normal().dot(direction());
209 }

◆ intersectionPoint()

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

Definition at line 227 of file ParametrizedLine.h.

228 {
229  return pointAt(intersectionParameter(hyperplane));
230 }
VectorType pointAt(const Scalar &t) const

◆ isApprox()

template<typename Scalar_ , int AmbientDim_, int Options_>
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()

Definition at line 171 of file ParametrizedLine.h.

172  { return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec); }

◆ origin() [1/2]

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

Definition at line 76 of file ParametrizedLine.h.

76 { return m_origin; }

◆ origin() [2/2]

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

Definition at line 75 of file ParametrizedLine.h.

75 { return m_origin; }

◆ pointAt()

template<typename Scalar_ , int AmbientDim_, int Options_>
ParametrizedLine< Scalar_, AmbientDim_, Options_ >::VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::pointAt ( const Scalar t) const
inline
Returns
the point at t along this line

Definition at line 196 of file ParametrizedLine.h.

197 {
198  return origin() + (direction()*t);
199 }

◆ projection()

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

Definition at line 95 of file ParametrizedLine.h.

96  { return origin() + direction().dot(p-origin()) * direction(); }

◆ squaredDistance()

template<typename Scalar_ , int AmbientDim_, int Options_>
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()

Definition at line 84 of file ParametrizedLine.h.

85  {
86  VectorType diff = p - origin();
87  return (diff - direction().dot(diff) * direction()).squaredNorm();
88  }

◆ Through()

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

Constructs a parametrized line going from p0 to p1.

Definition at line 67 of file ParametrizedLine.h.

68  { return ParametrizedLine(p0, (p1-p0).normalized()); }
Vector3f p0
Vector3f p1

◆ transform() [1/2]

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

Definition at line 116 of file ParametrizedLine.h.

117  {
118  if (traits==Affine)
119  direction() = (mat * direction()).normalized();
120  else if (traits==Isometry)
121  direction() = mat * direction();
122  else
123  {
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:902
@ Affine
Definition: Constants.h:464
@ Isometry
Definition: Constants.h:461

◆ transform() [2/2]

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

Definition at line 138 of file ParametrizedLine.h.

140  {
141  transform(t.linear(), traits);
142  origin() += t.translation();
143  return *this;
144  }
ParametrizedLine & transform(const MatrixBase< XprType > &mat, TransformTraits traits=Affine)

Member Data Documentation

◆ m_direction

template<typename Scalar_ , int AmbientDim_, int Options_>
VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::m_direction
protected

Definition at line 176 of file ParametrizedLine.h.

◆ m_origin

template<typename Scalar_ , int AmbientDim_, int Options_>
VectorType Eigen::ParametrizedLine< Scalar_, AmbientDim_, Options_ >::m_origin
protected

Definition at line 176 of file ParametrizedLine.h.


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