Eigen::Translation< Scalar_, Dim_ > Class Template Reference

Represents a translation transformation. More...

Public Types

enum  { Dim }
 
typedef Transform< Scalar, Dim, AffineAffineTransformType
 
typedef Transform< Scalar, Dim, IsometryIsometryTransformType
 
typedef Matrix< Scalar, Dim, DimLinearMatrixType
 
typedef Scalar_ Scalar
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 

Public Member Functions

template<typename NewScalarType >
internal::cast_return_type< Translation, Translation< NewScalarType, Dim > >::type cast () const
 
Translation inverse () const
 
bool isApprox (const Translation &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<typename OtherDerived >
AffineTransformType operator* (const EigenBase< OtherDerived > &linear) const
 
template<typename Derived >
std::enable_if_t< Derived::IsVectorAtCompileTime, VectorTypeoperator* (const MatrixBase< Derived > &vec) const
 
template<typename Derived >
IsometryTransformType operator* (const RotationBase< Derived, Dim > &r) const
 
template<int Mode, int Options>
Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
Translation operator* (const Translation &other) const
 
AffineTransformType operator* (const UniformScaling< Scalar > &other) const
 
 Translation ()
 
VectorTypetranslation ()
 
const VectorTypetranslation () const
 
 Translation (const Scalar &sx, const Scalar &sy)
 
 Translation (const Scalar &sx, const Scalar &sy, const Scalar &sz)
 
template<typename OtherScalarType >
 Translation (const Translation< OtherScalarType, Dim > &other)
 
 Translation (const VectorType &vector)
 
VectorTypevector ()
 
const VectorTypevector () const
 
Scalarx ()
 Returns the x-translation as a reference. More...
 
Scalar x () const
 Returns the x-translation by value. More...
 
Scalary ()
 Returns the y-translation as a reference. More...
 
Scalar y () const
 Returns the y-translation by value. More...
 
Scalarz ()
 Returns the z-translation as a reference. More...
 
Scalar z () const
 Returns the z-translation by value. More...
 

Static Public Member Functions

static const Translation Identity ()
 

Protected Attributes

VectorType m_coeffs
 

Detailed Description

template<typename Scalar_, int Dim_>
class Eigen::Translation< Scalar_, Dim_ >

Represents a translation transformation.

This is defined in the Geometry module.

Template Parameters
Scalar_the scalar type, i.e., the type of the coefficients.
Dim_the dimension of the space, can be a compile time value or Dynamic
Note
This class is not aimed to be used to store a translation transformation, but rather to make easier the constructions and updates of Transform objects.
See also
class Scaling, class Transform

Definition at line 32 of file Translation.h.

Member Typedef Documentation

◆ AffineTransformType

template<typename Scalar_ , int Dim_>
typedef Transform<Scalar,Dim,Affine> Eigen::Translation< Scalar_, Dim_ >::AffineTransformType

corresponding affine transformation type

Definition at line 45 of file Translation.h.

◆ IsometryTransformType

template<typename Scalar_ , int Dim_>
typedef Transform<Scalar,Dim,Isometry> Eigen::Translation< Scalar_, Dim_ >::IsometryTransformType

corresponding isometric transformation type

Definition at line 47 of file Translation.h.

◆ LinearMatrixType

template<typename Scalar_ , int Dim_>
typedef Matrix<Scalar,Dim,Dim> Eigen::Translation< Scalar_, Dim_ >::LinearMatrixType

corresponding linear transformation matrix type

Definition at line 43 of file Translation.h.

◆ Scalar

template<typename Scalar_ , int Dim_>
typedef Scalar_ Eigen::Translation< Scalar_, Dim_ >::Scalar

the scalar type of the coefficients

Definition at line 39 of file Translation.h.

◆ VectorType

template<typename Scalar_ , int Dim_>
typedef Matrix<Scalar,Dim,1> Eigen::Translation< Scalar_, Dim_ >::VectorType

corresponding vector type

Definition at line 41 of file Translation.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int Dim_>
anonymous enum

dimension of the space

Enumerator
Dim 

Definition at line 37 of file Translation.h.

37 { Dim = Dim_ };

Constructor & Destructor Documentation

◆ Translation() [1/5]

template<typename Scalar_ , int Dim_>
Eigen::Translation< Scalar_, Dim_ >::Translation ( )
inline

Default constructor without initialization.

Definition at line 56 of file Translation.h.

56 {}

◆ Translation() [2/5]

template<typename Scalar_ , int Dim_>
Eigen::Translation< Scalar_, Dim_ >::Translation ( const Scalar sx,
const Scalar sy 
)
inline

Definition at line 58 of file Translation.h.

59  {
60  eigen_assert(Dim==2);
61  m_coeffs.x() = sx;
62  m_coeffs.y() = sy;
63  }
#define eigen_assert(x)
Definition: Macros.h:902
VectorType m_coeffs
Definition: Translation.h:51

◆ Translation() [3/5]

template<typename Scalar_ , int Dim_>
Eigen::Translation< Scalar_, Dim_ >::Translation ( const Scalar sx,
const Scalar sy,
const Scalar sz 
)
inline

Definition at line 65 of file Translation.h.

66  {
67  eigen_assert(Dim==3);
68  m_coeffs.x() = sx;
69  m_coeffs.y() = sy;
70  m_coeffs.z() = sz;
71  }

◆ Translation() [4/5]

template<typename Scalar_ , int Dim_>
Eigen::Translation< Scalar_, Dim_ >::Translation ( const VectorType vector)
inlineexplicit

Constructs and initialize the translation transformation from a vector of translation coefficients

Definition at line 73 of file Translation.h.

73 : m_coeffs(vector) {}
const VectorType & vector() const
Definition: Translation.h:89

◆ Translation() [5/5]

template<typename Scalar_ , int Dim_>
template<typename OtherScalarType >
Eigen::Translation< Scalar_, Dim_ >::Translation ( const Translation< OtherScalarType, Dim > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 156 of file Translation.h.

157  { m_coeffs = other.vector().template cast<Scalar>(); }

Member Function Documentation

◆ cast()

template<typename Scalar_ , int Dim_>
template<typename NewScalarType >
internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type Eigen::Translation< Scalar_, Dim_ >::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 151 of file Translation.h.

152  { return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }

◆ Identity()

template<typename Scalar_ , int Dim_>
static const Translation Eigen::Translation< Scalar_, Dim_ >::Identity ( )
inlinestatic

Definition at line 143 of file Translation.h.

143 { return Translation(VectorType::Zero()); }

◆ inverse()

template<typename Scalar_ , int Dim_>
Translation Eigen::Translation< Scalar_, Dim_ >::inverse ( ) const
inline
Returns
the inverse translation (opposite)

Definition at line 141 of file Translation.h.

141 { return Translation(-m_coeffs); }

◆ isApprox()

template<typename Scalar_ , int Dim_>
bool Eigen::Translation< Scalar_, Dim_ >::isApprox ( const Translation< Scalar_, Dim_ > &  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 163 of file Translation.h.

164  { return m_coeffs.isApprox(other.m_coeffs, prec); }

◆ operator*() [1/6]

template<typename Scalar , int Dim>
template<typename OtherDerived >
Translation< Scalar, Dim >::AffineTransformType Eigen::Translation< Scalar, Dim >::operator* ( const EigenBase< OtherDerived > &  linear) const
inline

Concatenates a translation and a linear transformation

Definition at line 191 of file Translation.h.

192 {
194  res.matrix().setZero();
195  res.linear() = linear.derived();
196  res.translation() = m_coeffs;
197  res.matrix().row(Dim).setZero();
198  res(Dim,Dim) = Scalar(1);
199  return res;
200 }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Transform< Scalar, Dim, Affine > AffineTransformType
Definition: Translation.h:45

◆ operator*() [2/6]

template<typename Scalar_ , int Dim_>
template<typename Derived >
std::enable_if_t<Derived::IsVectorAtCompileTime,VectorType> Eigen::Translation< Scalar_, Dim_ >::operator* ( const MatrixBase< Derived > &  vec) const
inline

Applies translation to vector

Definition at line 137 of file Translation.h.

138  { return m_coeffs + vec.derived(); }

◆ operator*() [3/6]

template<typename Scalar_ , int Dim_>
template<typename Derived >
IsometryTransformType Eigen::Translation< Scalar_, Dim_ >::operator* ( const RotationBase< Derived, Dim > &  r) const
inline

Concatenates a translation and a rotation

Definition at line 108 of file Translation.h.

109  { return *this * IsometryTransformType(r); }
Transform< Scalar, Dim, Isometry > IsometryTransformType
Definition: Translation.h:47

◆ operator*() [4/6]

template<typename Scalar_ , int Dim_>
template<int Mode, int Options>
Transform<Scalar,Dim,Mode> Eigen::Translation< Scalar_, Dim_ >::operator* ( const Transform< Scalar, Dim, Mode, Options > &  t) const
inline

Concatenates a translation and a transformation

Definition at line 127 of file Translation.h.

128  {
129  Transform<Scalar,Dim,Mode> res = t;
130  res.pretranslate(m_coeffs);
131  return res;
132  }

◆ operator*() [5/6]

template<typename Scalar_ , int Dim_>
Translation Eigen::Translation< Scalar_, Dim_ >::operator* ( const Translation< Scalar_, Dim_ > &  other) const
inline

Concatenates two translation

Definition at line 96 of file Translation.h.

97  { return Translation(m_coeffs + other.m_coeffs); }

◆ operator*() [6/6]

template<typename Scalar , int Dim>
Translation< Scalar, Dim >::AffineTransformType Eigen::Translation< Scalar, Dim >::operator* ( const UniformScaling< Scalar > &  other) const
inline

Concatenates a translation and a uniform scaling

Definition at line 178 of file Translation.h.

179 {
181  res.matrix().setZero();
182  res.linear().diagonal().fill(other.factor());
183  res.translation() = m_coeffs;
184  res(Dim,Dim) = Scalar(1);
185  return res;
186 }

◆ translation() [1/2]

template<typename Scalar_ , int Dim_>
VectorType& Eigen::Translation< Scalar_, Dim_ >::translation ( )
inline

Definition at line 93 of file Translation.h.

93 { return m_coeffs; }

◆ translation() [2/2]

template<typename Scalar_ , int Dim_>
const VectorType& Eigen::Translation< Scalar_, Dim_ >::translation ( ) const
inline

Definition at line 92 of file Translation.h.

92 { return m_coeffs; }

◆ vector() [1/2]

template<typename Scalar_ , int Dim_>
VectorType& Eigen::Translation< Scalar_, Dim_ >::vector ( )
inline

Definition at line 90 of file Translation.h.

90 { return m_coeffs; }

◆ vector() [2/2]

template<typename Scalar_ , int Dim_>
const VectorType& Eigen::Translation< Scalar_, Dim_ >::vector ( ) const
inline

Definition at line 89 of file Translation.h.

89 { return m_coeffs; }

◆ x() [1/2]

template<typename Scalar_ , int Dim_>
Scalar& Eigen::Translation< Scalar_, Dim_ >::x ( )
inline

Returns the x-translation as a reference.

Definition at line 83 of file Translation.h.

83 { return m_coeffs.x(); }

◆ x() [2/2]

template<typename Scalar_ , int Dim_>
Scalar Eigen::Translation< Scalar_, Dim_ >::x ( ) const
inline

Returns the x-translation by value.

Definition at line 76 of file Translation.h.

76 { return m_coeffs.x(); }

◆ y() [1/2]

template<typename Scalar_ , int Dim_>
Scalar& Eigen::Translation< Scalar_, Dim_ >::y ( )
inline

Returns the y-translation as a reference.

Definition at line 85 of file Translation.h.

85 { return m_coeffs.y(); }

◆ y() [2/2]

template<typename Scalar_ , int Dim_>
Scalar Eigen::Translation< Scalar_, Dim_ >::y ( ) const
inline

Returns the y-translation by value.

Definition at line 78 of file Translation.h.

78 { return m_coeffs.y(); }

◆ z() [1/2]

template<typename Scalar_ , int Dim_>
Scalar& Eigen::Translation< Scalar_, Dim_ >::z ( )
inline

Returns the z-translation as a reference.

Definition at line 87 of file Translation.h.

87 { return m_coeffs.z(); }

◆ z() [2/2]

template<typename Scalar_ , int Dim_>
Scalar Eigen::Translation< Scalar_, Dim_ >::z ( ) const
inline

Returns the z-translation by value.

Definition at line 80 of file Translation.h.

80 { return m_coeffs.z(); }

Member Data Documentation

◆ m_coeffs

template<typename Scalar_ , int Dim_>
VectorType Eigen::Translation< Scalar_, Dim_ >::m_coeffs
protected

Definition at line 51 of file Translation.h.


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