Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
Eigen::Translation< _Scalar, _Dim > Class Template Reference

Represents a translation transformation. More...

#include <Translation.h>

+ Collaboration diagram for Eigen::Translation< _Scalar, _Dim >:

Public Types

enum  { Dim = _Dim }
 
enum  { Dim = _Dim }
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 
typedef Matrix< Scalar, Dim, Dim > LinearMatrixType
 
typedef Scaling< Scalar, Dim > ScalingType
 
typedef Transform< Scalar, Dim > TransformType
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 
typedef Matrix< Scalar, Dim, Dim > LinearMatrixType
 
typedef Transform< Scalar, Dim, Affine > AffineTransformType
 
typedef Transform< Scalar, Dim, Isometry > IsometryTransformType
 

Public Member Functions

 Translation ()
 
 Translation (const Scalar &sx, const Scalar &sy)
 
 Translation (const Scalar &sx, const Scalar &sy, const Scalar &sz)
 
 Translation (const VectorType &vector)
 
const VectorTypevector () const
 
VectorTypevector ()
 
Translation operator* (const Translation &other) const
 
TransformType operator* (const ScalingType &other) const
 
TransformType operator* (const LinearMatrixType &linear) const
 
template<typename Derived >
TransformType operator* (const RotationBase< Derived, Dim > &r) const
 
TransformType operator* (const TransformType &t) const
 
VectorType operator* (const VectorType &other) const
 
Translation inverse () const
 
Translationoperator= (const Translation &other)
 
template<typename NewScalarType >
internal::cast_return_type< Translation, Translation< NewScalarType, Dim > >::type cast () const
 
template<typename OtherScalarType >
 Translation (const Translation< OtherScalarType, Dim > &other)
 
bool isApprox (const Translation &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
 
 Translation ()
 
 Translation (const Scalar &sx, const Scalar &sy)
 
 Translation (const Scalar &sx, const Scalar &sy, const Scalar &sz)
 
 Translation (const VectorType &vector)
 
Scalar x () const
 Retruns the x-translation by value.
 
Scalar y () const
 Retruns the y-translation by value.
 
Scalar z () const
 Retruns the z-translation by value.
 
Scalarx ()
 Retruns the x-translation as a reference.
 
Scalary ()
 Retruns the y-translation as a reference.
 
Scalarz ()
 Retruns the z-translation as a reference.
 
const VectorTypevector () const
 
VectorTypevector ()
 
const VectorTypetranslation () const
 
VectorTypetranslation ()
 
Translation operator* (const Translation &other) const
 
AffineTransformType operator* (const UniformScaling< Scalar > &other) const
 
template<typename OtherDerived >
AffineTransformType operator* (const EigenBase< OtherDerived > &linear) 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
 
VectorType operator* (const VectorType &other) const
 
Translation inverse () const
 
Translationoperator= (const Translation &other)
 
template<typename NewScalarType >
internal::cast_return_type< Translation, Translation< NewScalarType, Dim > >::type cast () const
 
template<typename OtherScalarType >
 Translation (const Translation< OtherScalarType, Dim > &other)
 
bool isApprox (const Translation &other, typename NumTraits< Scalar >::Real prec=NumTraits< Scalar >::dummy_precision()) const
 

Static Public Member Functions

static const Translation Identity ()
 

Protected Attributes

VectorType m_coeffs
 

Friends

TransformType operator* (const LinearMatrixType &linear, const Translation &t)
 
template<typename OtherDerived >
AffineTransformType operator* (const EigenBase< OtherDerived > &linear, const Translation &t)
 

Detailed Description

template<typename _Scalar, int _Dim>
class Eigen::Translation< _Scalar, _Dim >

Represents a translation transformation.

Parameters
_Scalarthe scalar type, i.e., the type of the coefficients.
_Dimthe 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 236 of file ForwardDeclarations.h.

Member Typedef Documentation

template<typename _Scalar, int _Dim>
typedef Transform<Scalar,Dim,Affine> Eigen::Translation< _Scalar, _Dim >::AffineTransformType

corresponding affine transformation type

Definition at line 43 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Transform<Scalar,Dim,Isometry> Eigen::Translation< _Scalar, _Dim >::IsometryTransformType

corresponding isometric transformation type

Definition at line 45 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,Dim> Eigen::Translation< _Scalar, _Dim >::LinearMatrixType

corresponding linear transformation matrix type

Definition at line 40 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,Dim> Eigen::Translation< _Scalar, _Dim >::LinearMatrixType

corresponding linear transformation matrix type

Definition at line 41 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef _Scalar Eigen::Translation< _Scalar, _Dim >::Scalar

the scalar type of the coefficients

Definition at line 36 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef _Scalar Eigen::Translation< _Scalar, _Dim >::Scalar

the scalar type of the coefficients

Definition at line 37 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Scaling<Scalar,Dim> Eigen::Translation< _Scalar, _Dim >::ScalingType

corresponding scaling transformation type

Definition at line 42 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Transform<Scalar,Dim> Eigen::Translation< _Scalar, _Dim >::TransformType

corresponding affine transformation type

Definition at line 44 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,1> Eigen::Translation< _Scalar, _Dim >::VectorType

corresponding vector type

Definition at line 38 of file Translation.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,1> Eigen::Translation< _Scalar, _Dim >::VectorType

corresponding vector type

Definition at line 39 of file Translation.h.

Member Enumeration Documentation

template<typename _Scalar, int _Dim>
anonymous enum

dimension of the space

Definition at line 34 of file Translation.h.

34 { Dim = _Dim };
template<typename _Scalar, int _Dim>
anonymous enum

dimension of the space

Definition at line 35 of file Translation.h.

35 { Dim = _Dim };

Constructor & Destructor Documentation

template<typename _Scalar, int _Dim>
Eigen::Translation< _Scalar, _Dim >::Translation ( )
inline

Default constructor without initialization.

Definition at line 53 of file Translation.h.

53 {}
template<typename _Scalar, int _Dim>
Eigen::Translation< _Scalar, _Dim >::Translation ( const VectorType vector)
inlineexplicit

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

Definition at line 70 of file Translation.h.

70 : m_coeffs(vector) {}
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 129 of file Translation.h.

130  { m_coeffs = other.vector().template cast<Scalar>(); }
template<typename _Scalar, int _Dim>
Eigen::Translation< _Scalar, _Dim >::Translation ( )
inline

Default constructor without initialization.

Definition at line 54 of file Translation.h.

54 {}
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 71 of file Translation.h.

71 : m_coeffs(vector) {}
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 158 of file Translation.h.

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

Member Function Documentation

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 124 of file Translation.h.

125  { return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
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 153 of file Translation.h.

154  { return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
template<typename _Scalar, int _Dim>
Translation Eigen::Translation< _Scalar, _Dim >::inverse ( void  ) const
inline
Returns
the inverse translation (opposite)

Definition at line 110 of file Translation.h.

110 { return Translation(-m_coeffs); }
template<typename _Scalar, int _Dim>
Translation Eigen::Translation< _Scalar, _Dim >::inverse ( void  ) const
inline
Returns
the inverse translation (opposite)

Definition at line 137 of file Translation.h.

137 { return Translation(-m_coeffs); }
template<typename _Scalar, int _Dim>
bool Eigen::Translation< _Scalar, _Dim >::isApprox ( const Translation< _Scalar, _Dim > &  other,
typename NumTraits< Scalar >::Real  prec = precision<Scalar>() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 136 of file Translation.h.

137  { return m_coeffs.isApprox(other.m_coeffs, prec); }
template<typename _Scalar, int _Dim>
bool Eigen::Translation< _Scalar, _Dim >::isApprox ( const Translation< _Scalar, _Dim > &  other,
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 165 of file Translation.h.

166  { return m_coeffs.isApprox(other.m_coeffs, prec); }
template<typename _Scalar, int _Dim>
Translation Eigen::Translation< _Scalar, _Dim >::operator* ( const Translation< _Scalar, _Dim > &  other) const
inline

Concatenates two translation

Definition at line 76 of file Translation.h.

77  { return Translation(m_coeffs + other.m_coeffs); }
template<typename Scalar , int Dim>
Translation< Scalar, Dim >::TransformType Eigen::Translation< Scalar, Dim >::operator* ( const ScalingType other) const
inline

Concatenates a translation and a scaling

Definition at line 152 of file Translation.h.

153 {
154  TransformType res;
155  res.matrix().setZero();
156  res.linear().diagonal() = other.coeffs();
157  res.translation() = m_coeffs;
158  res(Dim,Dim) = Scalar(1);
159  return res;
160 }
Transform< Scalar, Dim > TransformType
Definition: Translation.h:44
template<typename Scalar , int Dim>
Translation< Scalar, Dim >::TransformType Eigen::Translation< Scalar, Dim >::operator* ( const LinearMatrixType linear) const
inline

Concatenates a translation and a linear transformation

Definition at line 164 of file Translation.h.

165 {
166  TransformType res;
167  res.matrix().setZero();
168  res.linear() = linear;
169  res.translation() = m_coeffs;
170  res.matrix().row(Dim).setZero();
171  res(Dim,Dim) = Scalar(1);
172  return res;
173 }
Derived & setZero(Index size)
Transform< Scalar, Dim > TransformType
Definition: Translation.h:44
template<typename _Scalar, int _Dim>
Translation Eigen::Translation< _Scalar, _Dim >::operator* ( const Translation< _Scalar, _Dim > &  other) const
inline

Concatenates two translation

Definition at line 94 of file Translation.h.

95  { return Translation(m_coeffs + other.m_coeffs); }
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 180 of file Translation.h.

181 {
183  res.matrix().setZero();
184  res.linear().diagonal().fill(other.factor());
185  res.translation() = m_coeffs;
186  res(Dim,Dim) = Scalar(1);
187  return res;
188 }
Transform< Scalar, Dim, Affine > AffineTransformType
Definition: Translation.h:43
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 193 of file Translation.h.

194 {
196  res.matrix().setZero();
197  res.linear() = linear.derived();
198  res.translation() = m_coeffs;
199  res.matrix().row(Dim).setZero();
200  res(Dim,Dim) = Scalar(1);
201  return res;
202 }
Transform< Scalar, Dim, Affine > AffineTransformType
Definition: Translation.h:43
Derived & setZero(Index size)
template<typename Scalar , int Dim>
Translation< Scalar, Dim >::TransformType Eigen::Translation< Scalar, Dim >::operator* ( const TransformType t) const
inline

Concatenates a translation and an affine transformation

Definition at line 177 of file Translation.h.

178 {
179  TransformType res = t;
180  res.pretranslate(m_coeffs);
181  return res;
182 }
Transform< Scalar, Dim > TransformType
Definition: Translation.h:44
template<typename _Scalar, int _Dim>
VectorType Eigen::Translation< _Scalar, _Dim >::operator* ( const VectorType other) const
inline

Applies translation to vector

Definition at line 106 of file Translation.h.

107  { return m_coeffs + other; }
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 106 of file Translation.h.

107  { return *this * IsometryTransformType(r); }
Transform< Scalar, Dim, Isometry > IsometryTransformType
Definition: Translation.h:45
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 125 of file Translation.h.

126  {
127  Transform<Scalar,Dim,Mode> res = t;
128  res.pretranslate(m_coeffs);
129  return res;
130  }
template<typename _Scalar, int _Dim>
VectorType Eigen::Translation< _Scalar, _Dim >::operator* ( const VectorType other) const
inline

Applies translation to vector

Definition at line 133 of file Translation.h.

134  { return m_coeffs + other; }

Friends And Related Function Documentation

template<typename _Scalar, int _Dim>
TransformType operator* ( const LinearMatrixType linear,
const Translation< _Scalar, _Dim > &  t 
)
friend

Concatenates a linear transformation and a translation

Definition at line 91 of file Translation.h.

92  {
93  TransformType res;
94  res.matrix().setZero();
95  res.linear() = linear;
96  res.translation() = linear * t.m_coeffs;
97  res.matrix().row(Dim).setZero();
98  res(Dim,Dim) = Scalar(1);
99  return res;
100  }
Transform< Scalar, Dim > TransformType
Definition: Translation.h:44
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
AffineTransformType operator* ( const EigenBase< OtherDerived > &  linear,
const Translation< _Scalar, _Dim > &  t 
)
friend
Returns
the concatenation of a linear transformation l with the translation t

Definition at line 112 of file Translation.h.

113  {
115  res.matrix().setZero();
116  res.linear() = linear.derived();
117  res.translation() = linear.derived() * t.m_coeffs;
118  res.matrix().row(Dim).setZero();
119  res(Dim,Dim) = Scalar(1);
120  return res;
121  }
Transform< Scalar, Dim, Affine > AffineTransformType
Definition: Translation.h:43

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