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

Represents an homogeneous transformation in a N dimensional space. More...

#include <Transform.h>

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

Classes

struct  construct_from_matrix
 
struct  construct_from_matrix< OtherDerived, true >
 

Public Types

enum  { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) }
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, HDim, HDim > MatrixType
 
typedef Matrix< Scalar, Dim, Dim > LinearMatrixType
 
typedef Block< MatrixType, Dim, Dim > LinearPart
 
typedef const Block< const MatrixType, Dim, Dim > ConstLinearPart
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 
typedef Block< MatrixType, Dim, 1 > TranslationPart
 
typedef const Block< const MatrixType, Dim, 1 > ConstTranslationPart
 
typedef Translation< Scalar, Dim > TranslationType
 
typedef Scaling< Scalar, Dim > ScalingType
 
typedef _Scalar Scalar
 
typedef DenseIndex Index
 
typedef internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
 
typedef const MatrixType ConstMatrixType
 
typedef Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
 
typedef Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact)> LinearPart
 
typedef const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact)> ConstLinearPart
 
typedef internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
 
typedef internal::conditional< int(Mode)==int(AffineCompact), const MatrixType &, const Block< const MatrixType, Dim, HDim > >::type ConstAffinePart
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 
typedef Block< MatrixType, Dim, 1, int(Mode)==(AffineCompact)> TranslationPart
 
typedef const Block< ConstMatrixType, Dim, 1, int(Mode)==(AffineCompact)> ConstTranslationPart
 
typedef Translation< Scalar, Dim > TranslationType
 
typedef Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
 
typedef internal::transform_take_affine_part< Transformtake_affine_part
 

Public Member Functions

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE (_Scalar, _Dim==Dynamic?Dynamic:(_Dim+1)*(_Dim+1)) enum
 
 Transform ()
 
 Transform (const Transform &other)
 
 Transform (const TranslationType &t)
 
 Transform (const ScalingType &s)
 
template<typename Derived >
 Transform (const RotationBase< Derived, Dim > &r)
 
Transformoperator= (const Transform &other)
 
template<typename OtherDerived >
 Transform (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformoperator= (const MatrixBase< OtherDerived > &other)
 
Scalar operator() (int row, int col) const
 
Scalaroperator() (int row, int col)
 
const MatrixTypematrix () const
 
MatrixTypematrix ()
 
ConstLinearPart linear () const
 
LinearPart linear ()
 
ConstTranslationPart translation () const
 
TranslationPart translation ()
 
template<typename OtherDerived >
const ei_transform_product_impl< OtherDerived, _Dim, _Dim+1 >::ResultType operator* (const MatrixBase< OtherDerived > &other) const
 
const Transform operator* (const Transform &other) const
 
void setIdentity ()
 
template<typename OtherDerived >
Transformscale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformprescale (const MatrixBase< OtherDerived > &other)
 
Transformscale (Scalar s)
 
Transformprescale (Scalar s)
 
template<typename OtherDerived >
Transformtranslate (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformpretranslate (const MatrixBase< OtherDerived > &other)
 
template<typename RotationType >
Transformrotate (const RotationType &rotation)
 
template<typename RotationType >
Transformprerotate (const RotationType &rotation)
 
Transformshear (Scalar sx, Scalar sy)
 
Transformpreshear (Scalar sx, Scalar sy)
 
Transformoperator= (const TranslationType &t)
 
Transformoperator*= (const TranslationType &t)
 
Transform operator* (const TranslationType &t) const
 
Transformoperator= (const ScalingType &t)
 
Transformoperator*= (const ScalingType &s)
 
Transform operator* (const ScalingType &s) const
 
template<typename Derived >
Transformoperator= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived >
Transformoperator*= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived >
Transform operator* (const RotationBase< Derived, Dim > &r) const
 
LinearMatrixType rotation () const
 
template<typename RotationMatrixType , typename ScalingMatrixType >
void computeRotationScaling (RotationMatrixType *rotation, ScalingMatrixType *scaling) const
 
template<typename ScalingMatrixType , typename RotationMatrixType >
void computeScalingRotation (ScalingMatrixType *scaling, RotationMatrixType *rotation) const
 
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
TransformfromPositionOrientationScale (const MatrixBase< PositionDerived > &position, const OrientationType &orientation, const MatrixBase< ScaleDerived > &scale)
 
const MatrixType inverse (TransformTraits traits=Affine) const
 
const Scalardata () const
 
Scalardata ()
 
template<typename NewScalarType >
internal::cast_return_type< Transform, Transform< NewScalarType, Dim > >::type cast () const
 
template<typename OtherScalarType >
 Transform (const Transform< OtherScalarType, Dim > &other)
 
bool isApprox (const Transform &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
 
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE (_Scalar, _Dim==Dynamic?Dynamic:(_Dim+1)*(_Dim+1)) enum
 
 Transform ()
 
 Transform (const Transform &other)
 
 Transform (const TranslationType &t)
 
 Transform (const UniformScaling< Scalar > &s)
 
template<typename Derived >
 Transform (const RotationBase< Derived, Dim > &r)
 
Transformoperator= (const Transform &other)
 
template<typename OtherDerived >
 Transform (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformoperator= (const EigenBase< OtherDerived > &other)
 
template<int OtherOptions>
 Transform (const Transform< Scalar, Dim, Mode, OtherOptions > &other)
 
template<int OtherMode, int OtherOptions>
 Transform (const Transform< Scalar, Dim, OtherMode, OtherOptions > &other)
 
template<typename OtherDerived >
 Transform (const ReturnByValue< OtherDerived > &other)
 
template<typename OtherDerived >
Transformoperator= (const ReturnByValue< OtherDerived > &other)
 
Scalar operator() (Index row, Index col) const
 
Scalaroperator() (Index row, Index col)
 
const MatrixTypematrix () const
 
MatrixTypematrix ()
 
ConstLinearPart linear () const
 
LinearPart linear ()
 
ConstAffinePart affine () const
 
AffinePart affine ()
 
ConstTranslationPart translation () const
 
TranslationPart translation ()
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE const internal::transform_right_product_impl< Transform, OtherDerived >::ResultType operator* (const EigenBase< OtherDerived > &other) const
 
template<typename DiagonalDerived >
const TransformTimeDiagonalReturnType operator* (const DiagonalBase< DiagonalDerived > &b) const
 
template<typename OtherDerived >
Transformoperator*= (const EigenBase< OtherDerived > &other)
 
const Transform operator* (const Transform &other) const
 
template<int OtherMode, int OtherOptions>
internal::transform_transform_product_impl< Transform, Transform< Scalar, Dim, OtherMode, OtherOptions > >::ResultType operator* (const Transform< Scalar, Dim, OtherMode, OtherOptions > &other) const
 
void setIdentity ()
 
template<typename OtherDerived >
Transformscale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformprescale (const MatrixBase< OtherDerived > &other)
 
Transformscale (const Scalar &s)
 
Transformprescale (const Scalar &s)
 
template<typename OtherDerived >
Transformtranslate (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transformpretranslate (const MatrixBase< OtherDerived > &other)
 
template<typename RotationType >
Transformrotate (const RotationType &rotation)
 
template<typename RotationType >
Transformprerotate (const RotationType &rotation)
 
Transformshear (const Scalar &sx, const Scalar &sy)
 
Transformpreshear (const Scalar &sx, const Scalar &sy)
 
Transformoperator= (const TranslationType &t)
 
Transformoperator*= (const TranslationType &t)
 
Transform operator* (const TranslationType &t) const
 
Transformoperator= (const UniformScaling< Scalar > &t)
 
Transformoperator*= (const UniformScaling< Scalar > &s)
 
Transform< Scalar, Dim,(int(Mode)==int(Isometry)?Affine:Isometry)> operator* (const UniformScaling< Scalar > &s) const
 
Transformoperator*= (const DiagonalMatrix< Scalar, Dim > &s)
 
template<typename Derived >
Transformoperator= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived >
Transformoperator*= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived >
Transform operator* (const RotationBase< Derived, Dim > &r) const
 
const LinearMatrixType rotation () const
 
template<typename RotationMatrixType , typename ScalingMatrixType >
void computeRotationScaling (RotationMatrixType *rotation, ScalingMatrixType *scaling) const
 
template<typename ScalingMatrixType , typename RotationMatrixType >
void computeScalingRotation (ScalingMatrixType *scaling, RotationMatrixType *rotation) const
 
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
TransformfromPositionOrientationScale (const MatrixBase< PositionDerived > &position, const OrientationType &orientation, const MatrixBase< ScaleDerived > &scale)
 
Transform inverse (TransformTraits traits=(TransformTraits) Mode) const
 
const Scalardata () const
 
Scalardata ()
 
template<typename NewScalarType >
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast () const
 
template<typename OtherScalarType >
 Transform (const Transform< OtherScalarType, Dim, Mode, Options > &other)
 
bool isApprox (const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
void makeAffine ()
 
Block< MatrixType, int(Mode)==int(Projective)?HDim:Dim, Dim > linearExt ()
 
const Block< MatrixType, int(Mode)==int(Projective)?HDim:Dim, Dim > linearExt () const
 
Block< MatrixType, int(Mode)==int(Projective)?HDim:Dim, 1 > translationExt ()
 
const Block< MatrixType, int(Mode)==int(Projective)?HDim:Dim, 1 > translationExt () const
 
template<typename OtherDerived >
Transform< Scalar, Dim > & scale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim > & prescale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim > & translate (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim > & pretranslate (const MatrixBase< OtherDerived > &other)
 
template<typename RotationType >
Transform< Scalar, Dim > & rotate (const RotationType &rotation)
 
template<typename RotationType >
Transform< Scalar, Dim > & prerotate (const RotationType &rotation)
 
template<typename Derived >
Transform< Scalar, Dim > & operator= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived>
Transform< Scalar, Dim > operator* (const RotationBase< Derived, Dim > &r) const
 
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
Transform< Scalar, Dim > & fromPositionOrientationScale (const MatrixBase< PositionDerived > &position, const OrientationType &orientation, const MatrixBase< ScaleDerived > &scale)
 
template<typename OtherDerived >
Transform< Scalar, Dim, Mode, Options > & scale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim, Mode, Options > & prescale (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim, Mode, Options > & translate (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Transform< Scalar, Dim, Mode, Options > & pretranslate (const MatrixBase< OtherDerived > &other)
 
template<typename RotationType >
Transform< Scalar, Dim, Mode, Options > & rotate (const RotationType &rotation)
 
template<typename RotationType >
Transform< Scalar, Dim, Mode, Options > & prerotate (const RotationType &rotation)
 
template<typename Derived >
Transform< Scalar, Dim, Mode, Options > & operator= (const RotationBase< Derived, Dim > &r)
 
template<typename Derived>
Transform< Scalar, Dim, Mode, Options > operator* (const RotationBase< Derived, Dim > &r) const
 
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
Transform< Scalar, Dim, Mode, Options > & fromPositionOrientationScale (const MatrixBase< PositionDerived > &position, const OrientationType &orientation, const MatrixBase< ScaleDerived > &scale)
 

Static Public Member Functions

static const MatrixType::IdentityReturnType Identity ()
 
static const Transform Identity ()
 Returns an identity transformation. More...
 

Static Protected Member Functions

static EIGEN_STRONG_INLINE void check_template_params ()
 

Protected Attributes

MatrixType m_matrix
 

Friends

template<typename OtherDerived >
const ProductReturnType< OtherDerived, MatrixType >::Type operator* (const MatrixBase< OtherDerived > &a, const Transform &b)
 
Transform operator* (const LinearMatrixType &mat, const Transform &t)
 
template<typename OtherDerived >
const internal::transform_left_product_impl< OtherDerived, Mode, Options, _Dim, _Dim+1 >::ResultType operator* (const EigenBase< OtherDerived > &a, const Transform &b)
 
template<typename DiagonalDerived >
TransformTimeDiagonalReturnType operator* (const DiagonalBase< DiagonalDerived > &a, const Transform &b)
 

Detailed Description

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

Represents an homogeneous transformation in a N dimensional space.

Parameters
_Scalarthe scalar type, i.e., the type of the coefficients
_Dimthe dimension of the space

The homography is internally represented and stored as a (Dim+1)^2 matrix which is available through the matrix() method.

Conversion methods from/to Qt's QMatrix and QTransform are available if the preprocessor token EIGEN_QT_SUPPORT is defined.

See also
class Matrix, class Quaternion
Template Parameters
_Scalarthe scalar type, i.e., the type of the coefficients
_Dimthe dimension of the space
_Modethe type of the transformation. Can be:
  • #Affine: the transformation is stored as a (Dim+1)^2 matrix, where the last row is assumed to be [0 ... 0 1].
  • #AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix.
  • #Projective: the transformation is stored as a (Dim+1)^2 matrix without any assumption.
_Optionshas the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor. These Options are passed directly to the underlying matrix type.

The homography is internally represented and stored by a matrix which is available through the matrix() method. To understand the behavior of this class you have to think a Transform object as its internal matrix representation. The chosen convention is right multiply:

v' = T * v

Therefore, an affine transformation matrix M is shaped like this:

$ \left( \begin{array}{cc} linear & translation\\ 0 ... 0 & 1 \end{array} \right) $

Note that for a projective transformation the last row can be anything, and then the interpretation of different parts might be sightly different.

However, unlike a plain matrix, the Transform class provides many features simplifying both its assembly and usage. In particular, it can be composed with any other transformations (Transform,Translation,RotationBase,Matrix) and can be directly used to transform implicit homogeneous vectors. All these operations are handled via the operator*. For the composition of transformations, its principle consists to first convert the right/left hand sides of the product to a compatible (Dim+1)^2 matrix and then perform a pure matrix product. Of course, internally, operator* tries to perform the minimal number of operations according to the nature of each terms. Likewise, when applying the transform to non homogeneous vectors, the latters are automatically promoted to homogeneous one before doing the matrix product. The convertions to homogeneous representations are performed as follow:

Translation t (Dim)x(1): $ \left( \begin{array}{cc} I & t \\ 0\,...\,0 & 1 \end{array} \right) $

Rotation R (Dim)x(Dim): $ \left( \begin{array}{cc} R & 0\\ 0\,...\,0 & 1 \end{array} \right) $

Linear Matrix L (Dim)x(Dim): $ \left( \begin{array}{cc} L & 0\\ 0\,...\,0 & 1 \end{array} \right) $

Affine Matrix A (Dim)x(Dim+1): $ \left( \begin{array}{c} A\\ 0\,...\,0\,1 \end{array} \right) $

Column vector v (Dim)x(1): $ \left( \begin{array}{c} v\\ 1 \end{array} \right) $

Set of column vectors V1...Vn (Dim)x(n): $ \left( \begin{array}{ccc} v_1 & ... & v_n\\ 1 & ... & 1 \end{array} \right) $

The concatenation of a Transform object with any kind of other transformation always returns a Transform object.

A little exception to the "as pure matrix product" rule is the case of the transformation of non homogeneous vectors by an affine transformation. In that case the last matrix row can be ignored, and the product returns non homogeneous vectors.

Since, for instance, a Dim x Dim matrix is interpreted as a linear transformation, it is not possible to directly transform Dim vectors stored in a Dim x Dim matrix. The solution is either to use a Dim x Dynamic matrix or explicitly request a vector transformation by making the vector homogeneous:

m' = T * m.colwise().homogeneous();

Note that there is zero overhead.

Conversion methods from/to Qt's QMatrix and QTransform are available if the preprocessor token EIGEN_QT_SUPPORT is defined.

This class can be extended with the help of the plugin mechanism described on the page TopicCustomizingEigen by defining the preprocessor symbol EIGEN_TRANSFORM_PLUGIN.

See also
class Matrix, class Quaternion

Definition at line 43 of file Transform.h.

Member Typedef Documentation

template<typename _Scalar, int _Dim>
typedef internal::conditional<int(Mode)==int(AffineCompact), MatrixType&, Block<MatrixType,Dim,HDim> >::type Eigen::Transform< _Scalar, _Dim >::AffinePart

type of read/write reference to the affine part of the transformation

Definition at line 203 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef internal::conditional<int(Mode)==int(AffineCompact), const MatrixType&, const Block<const MatrixType,Dim,HDim> >::type Eigen::Transform< _Scalar, _Dim >::ConstAffinePart

type of read reference to the affine part of the transformation

Definition at line 207 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef const Block<const MatrixType,Dim,Dim> Eigen::Transform< _Scalar, _Dim >::ConstLinearPart

type of read/write reference to the linear part of the transformation

Definition at line 60 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact)> Eigen::Transform< _Scalar, _Dim >::ConstLinearPart

type of read reference to the linear part of the transformation

Definition at line 199 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef const MatrixType Eigen::Transform< _Scalar, _Dim >::ConstMatrixType

constified MatrixType

Definition at line 193 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef const Block<const MatrixType,Dim,1> Eigen::Transform< _Scalar, _Dim >::ConstTranslationPart

type of a read/write reference to the translation part of the rotation

Definition at line 66 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef const Block<ConstMatrixType,Dim,1,int(Mode)==(AffineCompact)> Eigen::Transform< _Scalar, _Dim >::ConstTranslationPart

type of a read reference to the translation part of the rotation

Definition at line 213 of file Transform.h.

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

type of the matrix used to represent the linear part of the transformation

Definition at line 56 of file Transform.h.

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

type of the matrix used to represent the linear part of the transformation

Definition at line 195 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Block<MatrixType,Dim,Dim> Eigen::Transform< _Scalar, _Dim >::LinearPart

type of read/write reference to the linear part of the transformation

Definition at line 58 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact)> Eigen::Transform< _Scalar, _Dim >::LinearPart

type of read/write reference to the linear part of the transformation

Definition at line 197 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,HDim,HDim> Eigen::Transform< _Scalar, _Dim >::MatrixType

type of the matrix used to represent the transformation

Definition at line 54 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type Eigen::Transform< _Scalar, _Dim >::MatrixType

type of the matrix used to represent the transformation

Definition at line 191 of file Transform.h.

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

the scalar type of the coefficients

Definition at line 50 of file Transform.h.

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

the scalar type of the coefficients

Definition at line 186 of file Transform.h.

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

corresponding scaling transformation type

Definition at line 70 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Transform<Scalar,Dim,TransformTimeDiagonalMode> Eigen::Transform< _Scalar, _Dim >::TransformTimeDiagonalReturnType

The return type of the product between a diagonal matrix and a transform

Definition at line 220 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Block<MatrixType,Dim,1> Eigen::Transform< _Scalar, _Dim >::TranslationPart

type of a read/write reference to the translation part of the rotation

Definition at line 64 of file Transform.h.

template<typename _Scalar, int _Dim>
typedef Block<MatrixType,Dim,1,int(Mode)==(AffineCompact)> Eigen::Transform< _Scalar, _Dim >::TranslationPart

type of a read/write reference to the translation part of the rotation

Definition at line 211 of file Transform.h.

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

corresponding translation type

Definition at line 68 of file Transform.h.

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

corresponding translation type

Definition at line 215 of file Transform.h.

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

type of a vector

Definition at line 62 of file Transform.h.

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

type of a vector

Definition at line 209 of file Transform.h.

Constructor & Destructor Documentation

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

Default constructor without initialization of the coefficients.

Definition at line 79 of file Transform.h.

79 { }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Eigen::Transform< _Scalar, _Dim >::Transform ( const MatrixBase< OtherDerived > &  other)
inlineexplicit

Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix.

Definition at line 116 of file Transform.h.

117  {
118  construct_from_matrix<OtherDerived, int(OtherDerived::RowsAtCompileTime) == Dim>::run(this, other);
119  }
template<typename _Scalar, int _Dim>
template<typename OtherScalarType >
Eigen::Transform< _Scalar, _Dim >::Transform ( const Transform< OtherScalarType, Dim > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 263 of file Transform.h.

264  { m_matrix = other.matrix().template cast<Scalar>(); }
template<typename _Scalar, int _Dim>
Eigen::Transform< _Scalar, _Dim >::Transform ( )
inline

Default constructor without initialization of the meaningful coefficients. If Mode==Affine, then the last row is set to [0 ... 0 1]

Definition at line 230 of file Transform.h.

231  {
232  check_template_params();
233  if (int(Mode)==Affine)
234  makeAffine();
235  }
void makeAffine()
Definition: Transform.h:592
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Eigen::Transform< _Scalar, _Dim >::Transform ( const EigenBase< OtherDerived > &  other)
inlineexplicit

Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix.

Definition at line 267 of file Transform.h.

268  {
269  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
270  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
271 
272  check_template_params();
273  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
274  }
template<typename _Scalar, int _Dim>
template<typename OtherScalarType >
Eigen::Transform< _Scalar, _Dim >::Transform ( const Transform< OtherScalarType, Dim, Mode, Options > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 577 of file Transform.h.

578  {
579  check_template_params();
580  m_matrix = other.matrix().template cast<Scalar>();
581  }

Member Function Documentation

template<typename _Scalar, int _Dim>
ConstAffinePart Eigen::Transform< _Scalar, _Dim >::affine ( ) const
inline
Returns
a read-only expression of the Dim x HDim affine part of the transformation

Definition at line 377 of file Transform.h.

377 { return take_affine_part::run(m_matrix); }
template<typename _Scalar, int _Dim>
AffinePart Eigen::Transform< _Scalar, _Dim >::affine ( )
inline
Returns
a writable expression of the Dim x HDim affine part of the transformation

Definition at line 379 of file Transform.h.

379 { return take_affine_part::run(m_matrix); }
template<typename _Scalar, int _Dim>
template<typename NewScalarType >
internal::cast_return_type<Transform,Transform<NewScalarType,Dim> >::type Eigen::Transform< _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 258 of file Transform.h.

259  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim> >::type(*this); }
template<typename _Scalar, int _Dim>
template<typename NewScalarType >
internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type Eigen::Transform< _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 572 of file Transform.h.

573  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
template<typename Scalar , int Dim, int Mode, int Options>
template<typename RotationMatrixType , typename ScalingMatrixType >
void Transform::computeRotationScaling ( RotationMatrixType *  rotation,
ScalingMatrixType *  scaling 
) const

decomposes the linear part of the transformation as a product rotation x scaling, the scaling being not necessarily positive.

If either pointer is zero, the corresponding computation is skipped.

See also
computeScalingRotation(), rotation(), class SVD

decomposes the linear part of the transformation as a product rotation x scaling, the scaling being not necessarily positive.

If either pointer is zero, the corresponding computation is skipped.

See also
computeScalingRotation(), rotation(), class SVD

Definition at line 619 of file Transform.h.

620 {
621  JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU|ComputeFullV);
622  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
623  Matrix<Scalar, Dim, 1> sv(svd.singularValues());
624  sv.coeffRef(0) *= x;
625  if(scaling)
626  {
627  scaling->noalias() = svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint();
628  }
629  if(rotation)
630  {
631  LinearMatrixType m(svd.matrixU());
632  m.col(0) /= x;
633  rotation->noalias() = m * svd.matrixV().adjoint();
634  }
635 }
LinearMatrixType rotation() const
Definition: Transform.h:598
ConstLinearPart linear() const
Definition: Transform.h:148
_Scalar Scalar
Definition: Transform.h:50
Matrix< Scalar, Dim, Dim > LinearMatrixType
Definition: Transform.h:56
template<typename Scalar , int Dim, int Mode, int Options>
template<typename ScalingMatrixType , typename RotationMatrixType >
void Transform::computeScalingRotation ( ScalingMatrixType *  scaling,
RotationMatrixType *  rotation 
) const

decomposes the linear part of the transformation as a product rotation x scaling, the scaling being not necessarily positive.

If either pointer is zero, the corresponding computation is skipped.

See also
computeRotationScaling(), rotation(), class SVD

decomposes the linear part of the transformation as a product rotation x scaling, the scaling being not necessarily positive.

If either pointer is zero, the corresponding computation is skipped.

See also
computeRotationScaling(), rotation(), class SVD

Definition at line 650 of file Transform.h.

651 {
652  JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU|ComputeFullV);
653  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
654  Matrix<Scalar, Dim, 1> sv(svd.singularValues());
655  sv.coeffRef(0) *= x;
656  if(scaling)
657  {
658  scaling->noalias() = svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint();
659  }
660  if(rotation)
661  {
662  LinearMatrixType m(svd.matrixU());
663  m.col(0) /= x;
664  rotation->noalias() = m * svd.matrixV().adjoint();
665  }
666 }
LinearMatrixType rotation() const
Definition: Transform.h:598
ConstLinearPart linear() const
Definition: Transform.h:148
_Scalar Scalar
Definition: Transform.h:50
Matrix< Scalar, Dim, Dim > LinearMatrixType
Definition: Transform.h:56
template<typename _Scalar, int _Dim>
const Scalar* Eigen::Transform< _Scalar, _Dim >::data ( ) const
inline
Returns
a const pointer to the column major internal matrix

Definition at line 248 of file Transform.h.

248 { return m_matrix.data(); }
EIGEN_STRONG_INLINE const Scalar * data() const
template<typename _Scalar, int _Dim>
Scalar* Eigen::Transform< _Scalar, _Dim >::data ( )
inline
Returns
a non-const pointer to the column major internal matrix

Definition at line 250 of file Transform.h.

250 { return m_matrix.data(); }
EIGEN_STRONG_INLINE const Scalar * data() const
template<typename _Scalar, int _Dim>
const Scalar* Eigen::Transform< _Scalar, _Dim >::data ( ) const
inline
Returns
a const pointer to the column major internal matrix

Definition at line 562 of file Transform.h.

562 { return m_matrix.data(); }
EIGEN_STRONG_INLINE const Scalar * data() const
template<typename _Scalar, int _Dim>
Scalar* Eigen::Transform< _Scalar, _Dim >::data ( )
inline
Returns
a non-const pointer to the column major internal matrix

Definition at line 564 of file Transform.h.

564 { return m_matrix.data(); }
EIGEN_STRONG_INLINE const Scalar * data() const
template<typename _Scalar, int _Dim>
Eigen::Transform< _Scalar, _Dim >::EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE ( _Scalar  ,
_Dim  = =Dynamic ? Dynamic : (_Dim+1)*(_Dim+1) 
)
inline

< space dimension in which the transformation holds

< size of a respective homogeneous vector

Definition at line 46 of file Transform.h.

46  : (_Dim+1)*(_Dim+1))
47  enum {
48  Dim = _Dim,
49  HDim = _Dim+1
50  };
template<typename _Scalar, int _Dim>
Eigen::Transform< _Scalar, _Dim >::EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE ( _Scalar  ,
_Dim  = =Dynamic ? Dynamic : (_Dim+1)*(_Dim+1) 
)
inline

< space dimension in which the transformation holds

< size of a respective homogeneous vector

Definition at line 179 of file Transform.h.

179  : (_Dim+1)*(_Dim+1))
180  enum {
181  Mode = _Mode,
182  Options = _Options,
183  Dim = _Dim,
184  HDim = _Dim+1,
185  Rows = int(Mode)==(AffineCompact) ? Dim : HDim
186  };
template<typename _Scalar, int _Dim>
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::fromPositionOrientationScale ( const MatrixBase< PositionDerived > &  position,
const OrientationType &  orientation,
const MatrixBase< ScaleDerived > &  scale 
)

Convenient method to set *this from a position, orientation and scale of a 3D object.

Definition at line 674 of file Transform.h.

676 {
677  linear() = ei_toRotationMatrix<Scalar,Dim>(orientation);
678  linear() *= scale.asDiagonal();
679  translation() = position;
680  m_matrix.template block<1,Dim>(Dim,0).setZero();
681  m_matrix(Dim,Dim) = Scalar(1);
682  return *this;
683 }
ConstLinearPart linear() const
Definition: Transform.h:148
ConstTranslationPart translation() const
Definition: Transform.h:153
_Scalar Scalar
Definition: Transform.h:50
template<typename _Scalar, int _Dim>
template<typename PositionDerived , typename OrientationType , typename ScaleDerived >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::fromPositionOrientationScale ( const MatrixBase< PositionDerived > &  position,
const OrientationType &  orientation,
const MatrixBase< ScaleDerived > &  scale 
)

Convenient method to set *this from a position, orientation and scale of a 3D object.

Definition at line 1070 of file Transform.h.

1072 {
1073  linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1074  linear() *= scale.asDiagonal();
1075  translation() = position;
1076  makeAffine();
1077  return *this;
1078 }
ConstLinearPart linear() const
Definition: Transform.h:148
ConstTranslationPart translation() const
Definition: Transform.h:153
void makeAffine()
Definition: Transform.h:592
template<typename _Scalar, int _Dim>
static const Transform Eigen::Transform< _Scalar, _Dim >::Identity ( )
inlinestatic

Returns an identity transformation.

Todo:
In the future this function should be returning a Transform expression.

Definition at line 498 of file Transform.h.

499  {
500  return Transform(MatrixType::Identity());
501  }
template<typename Scalar , int Dim, int Mode, int Options>
Transform< Scalar, Dim, Mode, Options > Transform::inverse ( TransformTraits  hint = Affine) const
inline
Returns
the inverse transformation matrix according to some given knowledge on *this.
Parameters
traitsallows to optimize the inversion process when the transformion is known to be not a general transformation. The possible values are:
  • Projective if the transformation is not necessarily affine, i.e., if the last row is not guaranteed to be [0 ... 0 1]
  • Affine is the default, the last row is assumed to be [0 ... 0 1]
  • Isometry if the transformation is only a concatenations of translations and rotations.
Warning
unless traits is always set to NoShear or NoScaling, this function requires the generic inverse method of MatrixBase defined in the LU module. If you forget to include this module, then you will get hard to debug linking errors.
See also
MatrixBase::inverse()
Returns
the inverse transformation according to some given knowledge on *this.
Parameters
hintallows to optimize the inversion process when the transformation is known to be not a general transformation (optional). The possible values are:
  • #Projective if the transformation is not necessarily affine, i.e., if the last row is not guaranteed to be [0 ... 0 1]
  • #Affine if the last row can be assumed to be [0 ... 0 1]
  • #Isometry if the transformation is only a concatenations of translations and rotations. The default is the template class parameter Mode.
Warning
unless traits is always set to NoShear or NoScaling, this function requires the generic inverse method of MatrixBase defined in the LU module. If you forget to include this module, then you will get hard to debug linking errors.
See also
MatrixBase::inverse()

Definition at line 706 of file Transform.h.

707 {
708  if (traits == Projective)
709  {
710  return m_matrix.inverse();
711  }
712  else
713  {
714  MatrixType res;
715  if (traits == Affine)
716  {
717  res.template corner<Dim,Dim>(TopLeft) = linear().inverse();
718  }
719  else if (traits == Isometry)
720  {
721  res.template corner<Dim,Dim>(TopLeft) = linear().transpose();
722  }
723  else
724  {
725  ei_assert("invalid traits value in Transform::inverse()");
726  }
727  // translation and remaining parts
728  res.template corner<Dim,1>(TopRight) = - res.template corner<Dim,Dim>(TopLeft) * translation();
729  res.template corner<1,Dim>(BottomLeft).setZero();
730  res.coeffRef(Dim,Dim) = Scalar(1);
731  return res;
732  }
733 }
ConstLinearPart linear() const
Definition: Transform.h:148
ConstTranslationPart translation() const
Definition: Transform.h:153
_Scalar Scalar
Definition: Transform.h:50
Matrix< Scalar, HDim, HDim > MatrixType
Definition: Transform.h:54
template<typename _Scalar, int _Dim>
bool Eigen::Transform< _Scalar, _Dim >::isApprox ( const Transform< _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 270 of file Transform.h.

271  { return m_matrix.isApprox(other.m_matrix, prec); }
template<typename _Scalar, int _Dim>
bool Eigen::Transform< _Scalar, _Dim >::isApprox ( const Transform< _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 587 of file Transform.h.

588  { return m_matrix.isApprox(other.m_matrix, prec); }
template<typename _Scalar, int _Dim>
ConstLinearPart Eigen::Transform< _Scalar, _Dim >::linear ( ) const
inline
Returns
a read-only expression of the linear (linear) part of the transformation

Definition at line 148 of file Transform.h.

148 { return m_matrix.template block<Dim,Dim>(0,0); }
template<typename _Scalar, int _Dim>
LinearPart Eigen::Transform< _Scalar, _Dim >::linear ( )
inline
Returns
a writable expression of the linear (linear) part of the transformation

Definition at line 150 of file Transform.h.

150 { return m_matrix.template block<Dim,Dim>(0,0); }
template<typename _Scalar, int _Dim>
ConstLinearPart Eigen::Transform< _Scalar, _Dim >::linear ( ) const
inline
Returns
a read-only expression of the linear part of the transformation

Definition at line 372 of file Transform.h.

372 { return ConstLinearPart(m_matrix,0,0); }
const Block< const MatrixType, Dim, Dim > ConstLinearPart
Definition: Transform.h:60
template<typename _Scalar, int _Dim>
LinearPart Eigen::Transform< _Scalar, _Dim >::linear ( )
inline
Returns
a writable expression of the linear part of the transformation

Definition at line 374 of file Transform.h.

374 { return LinearPart(m_matrix,0,0); }
Block< MatrixType, Dim, Dim > LinearPart
Definition: Transform.h:58
template<typename _Scalar, int _Dim>
void Eigen::Transform< _Scalar, _Dim >::makeAffine ( )
inline

Sets the last row to [0 ... 0 1]

Definition at line 592 of file Transform.h.

593  {
594  if(int(Mode)!=int(AffineCompact))
595  {
596  matrix().template block<1,Dim>(Dim,0).setZero();
597  matrix().coeffRef(Dim,Dim) = Scalar(1);
598  }
599  }
const MatrixType & matrix() const
Definition: Transform.h:143
_Scalar Scalar
Definition: Transform.h:50
template<typename _Scalar, int _Dim>
const MatrixType& Eigen::Transform< _Scalar, _Dim >::matrix ( ) const
inline
Returns
a read-only expression of the transformation matrix

Definition at line 143 of file Transform.h.

143 { return m_matrix; }
template<typename _Scalar, int _Dim>
MatrixType& Eigen::Transform< _Scalar, _Dim >::matrix ( )
inline
Returns
a writable expression of the transformation matrix

Definition at line 145 of file Transform.h.

145 { return m_matrix; }
template<typename _Scalar, int _Dim>
const MatrixType& Eigen::Transform< _Scalar, _Dim >::matrix ( ) const
inline
Returns
a read-only expression of the transformation matrix

Definition at line 367 of file Transform.h.

367 { return m_matrix; }
template<typename _Scalar, int _Dim>
MatrixType& Eigen::Transform< _Scalar, _Dim >::matrix ( )
inline
Returns
a writable expression of the transformation matrix

Definition at line 369 of file Transform.h.

369 { return m_matrix; }
template<typename _Scalar, int _Dim>
Scalar Eigen::Transform< _Scalar, _Dim >::operator() ( int  row,
int  col 
) const
inline

shortcut for m_matrix(row,col);

See also
MatrixBase::operaror(int,int) const

Definition at line 137 of file Transform.h.

137 { return m_matrix(row,col); }
template<typename _Scalar, int _Dim>
Scalar& Eigen::Transform< _Scalar, _Dim >::operator() ( int  row,
int  col 
)
inline

shortcut for m_matrix(row,col);

See also
MatrixBase::operaror(int,int)

Definition at line 140 of file Transform.h.

140 { return m_matrix(row,col); }
template<typename _Scalar, int _Dim>
Scalar Eigen::Transform< _Scalar, _Dim >::operator() ( Index  row,
Index  col 
) const
inline

shortcut for m_matrix(row,col);

See also
MatrixBase::operator(Index,Index) const

Definition at line 361 of file Transform.h.

361 { return m_matrix(row,col); }
template<typename _Scalar, int _Dim>
Scalar& Eigen::Transform< _Scalar, _Dim >::operator() ( Index  row,
Index  col 
)
inline

shortcut for m_matrix(row,col);

See also
MatrixBase::operator(Index,Index)

Definition at line 364 of file Transform.h.

364 { return m_matrix(row,col); }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
const ei_transform_product_impl<OtherDerived,_Dim,_Dim+1>::ResultType Eigen::Transform< _Scalar, _Dim >::operator* ( const MatrixBase< OtherDerived > &  other) const
inline
Returns
an expression of the product between the transform *this and a matrix expression other

The right hand side other might be either:

  • a vector of size Dim,
  • an homogeneous vector of size Dim+1,
  • a transformation matrix of size Dim+1 x Dim+1.

Definition at line 167 of file Transform.h.

168  { return ei_transform_product_impl<OtherDerived,Dim,HDim>::run(*this,other.derived()); }
template<typename _Scalar, int _Dim>
const Transform Eigen::Transform< _Scalar, _Dim >::operator* ( const Transform< _Scalar, _Dim > &  other) const
inline

Contatenates two transformations

Definition at line 179 of file Transform.h.

180  { return Transform(m_matrix * other.matrix()); }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
EIGEN_STRONG_INLINE const internal::transform_right_product_impl<Transform, OtherDerived>::ResultType Eigen::Transform< _Scalar, _Dim >::operator* ( const EigenBase< OtherDerived > &  other) const
inline
Returns
an expression of the product between the transform *this and a matrix expression other

The right hand side other might be either:

  • a vector of size Dim,
  • an homogeneous vector of size Dim+1,
  • a set of vectors of size Dim x Dynamic,
  • a set of homogeneous vectors of size Dim+1 x Dynamic,
  • a linear transformation matrix of size Dim x Dim,
  • an affine transformation matrix of size Dim x Dim+1,
  • a transformation matrix of size Dim+1 x Dim+1.

Definition at line 400 of file Transform.h.

401  { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
template<typename _Scalar, int _Dim>
template<typename DiagonalDerived >
const TransformTimeDiagonalReturnType Eigen::Transform< _Scalar, _Dim >::operator* ( const DiagonalBase< DiagonalDerived > &  b) const
inline
Returns
The product expression of a transform a times a diagonal matrix b

The rhs diagonal matrix is interpreted as an affine scaling transformation. The product results in a Transform of the same type (mode) as the lhs only if the lhs mode is no isometry. In that case, the returned transform is an affinity.

Definition at line 423 of file Transform.h.

424  {
426  res.linear() *= b;
427  return res;
428  }
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:220
template<typename _Scalar, int _Dim>
const Transform Eigen::Transform< _Scalar, _Dim >::operator* ( const Transform< _Scalar, _Dim > &  other) const
inline

Concatenates two transformations

Definition at line 452 of file Transform.h.

453  {
454  return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
455  }
template<typename _Scalar, int _Dim>
template<int OtherMode, int OtherOptions>
internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType Eigen::Transform< _Scalar, _Dim >::operator* ( const Transform< Scalar, Dim, OtherMode, OtherOptions > &  other) const
inline

Concatenates two different transformations

Definition at line 485 of file Transform.h.

486  {
487  return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
488  }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform& Eigen::Transform< _Scalar, _Dim >::operator= ( const MatrixBase< OtherDerived > &  other)
inline

Set *this from a (Dim+1)^2 matrix.

Definition at line 123 of file Transform.h.

124  { m_matrix = other; return *this; }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform& Eigen::Transform< _Scalar, _Dim >::operator= ( const EigenBase< OtherDerived > &  other)
inline

Set *this from a Dim^2 or (Dim+1)^2 matrix.

Definition at line 278 of file Transform.h.

279  {
280  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
281  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
282 
283  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
284  return *this;
285  }
template<typename _Scalar, int _Dim>
template<typename RotationType >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::prerotate ( const RotationType &  rotation)

Applies on the left the rotation represented by the rotation rotation to *this and returns a reference to *this.

See rotate() for further details.

See also
rotate()

Definition at line 490 of file Transform.h.

491 {
492  m_matrix.template block<Dim,HDim>(0,0) = ei_toRotationMatrix<Scalar,Dim>(rotation)
493  * m_matrix.template block<Dim,HDim>(0,0);
494  return *this;
495 }
LinearMatrixType rotation() const
Definition: Transform.h:598
template<typename _Scalar, int _Dim>
template<typename RotationType >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::prerotate ( const RotationType &  rotation)

Applies on the left the rotation represented by the rotation rotation to *this and returns a reference to *this.

See rotate() for further details.

See also
rotate()

Definition at line 898 of file Transform.h.

899 {
900  m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
901  * m_matrix.template block<Dim,HDim>(0,0);
902  return *this;
903 }
LinearMatrixType rotation() const
Definition: Transform.h:598
template<typename Scalar , int Dim>
Transform< Scalar, Dim > & Transform::prescale ( Scalar  s)
inline

Applies on the left a uniform scale of a factor c to *this and returns a reference to *this.

See also
scale(Scalar)

Definition at line 420 of file Transform.h.

421 {
422  m_matrix.template corner<Dim,HDim>(TopLeft) *= s;
423  return *this;
424 }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::prescale ( const MatrixBase< OtherDerived > &  other)

Applies on the left the non uniform scale transformation represented by the vector other to *this and returns a reference to *this.

See also
scale()

Definition at line 408 of file Transform.h.

409 {
410  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
411  m_matrix.template block<Dim,HDim>(0,0) = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0)).lazy();
412  return *this;
413 }
template<typename Scalar , int Dim, int Mode, int Options>
Transform< Scalar, Dim, Mode, Options > & Transform::prescale ( const Scalar s)
inline

Applies on the left a uniform scale of a factor c to *this and returns a reference to *this.

See also
scale(Scalar)

Definition at line 824 of file Transform.h.

825 {
826  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
827  m_matrix.template topRows<Dim>() *= s;
828  return *this;
829 }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::prescale ( const MatrixBase< OtherDerived > &  other)

Applies on the left the non uniform scale transformation represented by the vector other to *this and returns a reference to *this.

See also
scale()

Definition at line 811 of file Transform.h.

812 {
813  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
814  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
815  m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
816  return *this;
817 }
template<typename Scalar , int Dim>
Transform< Scalar, Dim > & Transform::preshear ( Scalar  sx,
Scalar  sy 
)

Applies on the left the shear transformation represented by the vector other to *this and returns a reference to *this.

Warning
2D only.
See also
shear()

Definition at line 519 of file Transform.h.

520 {
521  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
522  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
523  return *this;
524 }
Matrix< Scalar, Dim, Dim > LinearMatrixType
Definition: Transform.h:56
template<typename Scalar , int Dim, int Mode, int Options>
Transform< Scalar, Dim, Mode, Options > & Transform::preshear ( const Scalar sx,
const Scalar sy 
)

Applies on the left the shear transformation represented by the vector other to *this and returns a reference to *this.

Warning
2D only.
See also
shear()

Definition at line 928 of file Transform.h.

929 {
930  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
931  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
932  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
933  return *this;
934 }
Matrix< Scalar, Dim, Dim > LinearMatrixType
Definition: Transform.h:56
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::pretranslate ( const MatrixBase< OtherDerived > &  other)

Applies on the left the translation matrix represented by the vector other to *this and returns a reference to *this.

See also
translate()

Definition at line 447 of file Transform.h.

448 {
449  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
450  translation() += other;
451  return *this;
452 }
ConstTranslationPart translation() const
Definition: Transform.h:153
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::pretranslate ( const MatrixBase< OtherDerived > &  other)

Applies on the left the translation matrix represented by the vector other to *this and returns a reference to *this.

See also
translate()

Definition at line 852 of file Transform.h.

853 {
854  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
855  if(int(Mode)==int(Projective))
856  affine() += other * m_matrix.row(Dim);
857  else
858  translation() += other;
859  return *this;
860 }
ConstAffinePart affine() const
Definition: Transform.h:377
ConstTranslationPart translation() const
Definition: Transform.h:153
template<typename _Scalar, int _Dim>
template<typename RotationType >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::rotate ( const RotationType &  rotation)

Applies on the right the rotation represented by the rotation rotation to *this and returns a reference to *this.

The template parameter RotationType is the type of the rotation which must be known by ei_toRotationMatrix<>.

Natively supported types includes:

This mechanism is easily extendable to support user types such as Euler angles, or a pair of Quaternion for 4D rotations.

See also
rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType)

Definition at line 474 of file Transform.h.

475 {
476  linear() *= ei_toRotationMatrix<Scalar,Dim>(rotation);
477  return *this;
478 }
LinearMatrixType rotation() const
Definition: Transform.h:598
ConstLinearPart linear() const
Definition: Transform.h:148
template<typename _Scalar, int _Dim>
template<typename RotationType >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::rotate ( const RotationType &  rotation)

Applies on the right the rotation represented by the rotation rotation to *this and returns a reference to *this.

The template parameter RotationType is the type of the rotation which must be known by internal::toRotationMatrix<>.

Natively supported types includes:

This mechanism is easily extendable to support user types such as Euler angles, or a pair of Quaternion for 4D rotations.

See also
rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType)

Definition at line 882 of file Transform.h.

883 {
884  linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
885  return *this;
886 }
LinearMatrixType rotation() const
Definition: Transform.h:598
template<typename Scalar , int Dim, int Mode, int Options>
const Transform< Scalar, Dim, Mode, Options >::LinearMatrixType Transform::rotation ( ) const
Returns
the rotation part of the transformation
See also
computeRotationScaling(), computeScalingRotation(), class SVD
Returns
the rotation part of the transformation
See also
computeRotationScaling(), computeScalingRotation(), class SVD

Definition at line 598 of file Transform.h.

599 {
600  LinearMatrixType result;
602  return result;
603 }
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition: Transform.h:619
Matrix< Scalar, Dim, Dim > LinearMatrixType
Definition: Transform.h:56
template<typename Scalar , int Dim>
Transform< Scalar, Dim > & Transform::scale ( Scalar  s)
inline

Applies on the right a uniform scale of a factor c to *this and returns a reference to *this.

See also
prescale(Scalar)

Definition at line 395 of file Transform.h.

396 {
397  linear() *= s;
398  return *this;
399 }
ConstLinearPart linear() const
Definition: Transform.h:148
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::scale ( const MatrixBase< OtherDerived > &  other)

Applies on the right the non uniform scale transformation represented by the vector other to *this and returns a reference to *this.

See also
prescale()

Definition at line 383 of file Transform.h.

384 {
385  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
386  linear() = (linear() * other.asDiagonal()).lazy();
387  return *this;
388 }
ConstLinearPart linear() const
Definition: Transform.h:148
template<typename Scalar , int Dim, int Mode, int Options>
Transform< Scalar, Dim, Mode, Options > & Transform::scale ( const Scalar s)
inline

Applies on the right a uniform scale of a factor c to *this and returns a reference to *this.

See also
prescale(Scalar)

Definition at line 797 of file Transform.h.

798 {
799  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
800  linearExt() *= s;
801  return *this;
802 }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::scale ( const MatrixBase< OtherDerived > &  other)

Applies on the right the non uniform scale transformation represented by the vector other to *this and returns a reference to *this.

See also
prescale()

Definition at line 784 of file Transform.h.

785 {
786  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
787  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
788  linearExt().noalias() = (linearExt() * other.asDiagonal());
789  return *this;
790 }
template<typename _Scalar, int _Dim>
void Eigen::Transform< _Scalar, _Dim >::setIdentity ( )
inline
See also
MatrixBase::setIdentity()

Definition at line 183 of file Transform.h.

183 { m_matrix.setIdentity(); }
template<typename _Scalar, int _Dim>
void Eigen::Transform< _Scalar, _Dim >::setIdentity ( )
inline
See also
MatrixBase::setIdentity()

Definition at line 492 of file Transform.h.

492 { m_matrix.setIdentity(); }
template<typename Scalar , int Dim>
Transform< Scalar, Dim > & Transform::shear ( Scalar  sx,
Scalar  sy 
)

Applies on the right the shear transformation represented by the vector other to *this and returns a reference to *this.

Warning
2D only.
See also
preshear()

Definition at line 504 of file Transform.h.

505 {
506  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
507  VectorType tmp = linear().col(0)*sy + linear().col(1);
508  linear() << linear().col(0) + linear().col(1)*sx, tmp;
509  return *this;
510 }
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:62
ConstLinearPart linear() const
Definition: Transform.h:148
template<typename Scalar , int Dim, int Mode, int Options>
Transform< Scalar, Dim, Mode, Options > & Transform::shear ( const Scalar sx,
const Scalar sy 
)

Applies on the right the shear transformation represented by the vector other to *this and returns a reference to *this.

Warning
2D only.
See also
preshear()

Definition at line 912 of file Transform.h.

913 {
914  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
915  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
916  VectorType tmp = linear().col(0)*sy + linear().col(1);
917  linear() << linear().col(0) + linear().col(1)*sx, tmp;
918  return *this;
919 }
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:62
ConstLinearPart linear() const
Definition: Transform.h:148
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim>& Eigen::Transform< _Scalar, _Dim >::translate ( const MatrixBase< OtherDerived > &  other)

Applies on the right the translation matrix represented by the vector other to *this and returns a reference to *this.

See also
pretranslate()

Definition at line 433 of file Transform.h.

434 {
435  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
436  translation() += linear() * other;
437  return *this;
438 }
ConstLinearPart linear() const
Definition: Transform.h:148
ConstTranslationPart translation() const
Definition: Transform.h:153
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
Transform<Scalar,Dim,Mode,Options>& Eigen::Transform< _Scalar, _Dim >::translate ( const MatrixBase< OtherDerived > &  other)

Applies on the right the translation matrix represented by the vector other to *this and returns a reference to *this.

See also
pretranslate()

Definition at line 838 of file Transform.h.

839 {
840  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
841  translationExt() += linearExt() * other;
842  return *this;
843 }
template<typename _Scalar, int _Dim>
ConstTranslationPart Eigen::Transform< _Scalar, _Dim >::translation ( ) const
inline
Returns
a read-only expression of the translation vector of the transformation

Definition at line 153 of file Transform.h.

153 { return m_matrix.template block<Dim,1>(0,Dim); }
template<typename _Scalar, int _Dim>
TranslationPart Eigen::Transform< _Scalar, _Dim >::translation ( )
inline
Returns
a writable expression of the translation vector of the transformation

Definition at line 155 of file Transform.h.

155 { return m_matrix.template block<Dim,1>(0,Dim); }
template<typename _Scalar, int _Dim>
ConstTranslationPart Eigen::Transform< _Scalar, _Dim >::translation ( ) const
inline
Returns
a read-only expression of the translation vector of the transformation

Definition at line 382 of file Transform.h.

382 { return ConstTranslationPart(m_matrix,0,Dim); }
const Block< const MatrixType, Dim, 1 > ConstTranslationPart
Definition: Transform.h:66
template<typename _Scalar, int _Dim>
TranslationPart Eigen::Transform< _Scalar, _Dim >::translation ( )
inline
Returns
a writable expression of the translation vector of the transformation

Definition at line 384 of file Transform.h.

384 { return TranslationPart(m_matrix,0,Dim); }
Block< MatrixType, Dim, 1 > TranslationPart
Definition: Transform.h:64

Friends And Related Function Documentation

template<typename _Scalar, int _Dim>
template<typename OtherDerived >
const ProductReturnType<OtherDerived,MatrixType>::Type operator* ( const MatrixBase< OtherDerived > &  a,
const Transform< _Scalar, _Dim > &  b 
)
friend
Returns
the product expression of a transformation matrix a times a transform b The transformation matrix a must have a Dim+1 x Dim+1 sizes.

Definition at line 174 of file Transform.h.

175  { return a.derived() * b.matrix(); }
template<typename _Scalar, int _Dim>
template<typename OtherDerived >
const internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType operator* ( const EigenBase< OtherDerived > &  a,
const Transform< _Scalar, _Dim > &  b 
)
friend
Returns
the product expression of a transformation matrix a times a transform b

The left hand side other might be either:

  • a linear transformation matrix of size Dim x Dim,
  • an affine transformation matrix of size Dim x Dim+1,
  • a general transformation matrix of size Dim+1 x Dim+1.

Definition at line 412 of file Transform.h.

413  { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
template<typename _Scalar, int _Dim>
template<typename DiagonalDerived >
TransformTimeDiagonalReturnType operator* ( const DiagonalBase< DiagonalDerived > &  a,
const Transform< _Scalar, _Dim > &  b 
)
friend
Returns
The product expression of a diagonal matrix a times a transform b

The lhs diagonal matrix is interpreted as an affine scaling transformation. The product results in a Transform of the same type (mode) as the lhs only if the lhs mode is no isometry. In that case, the returned transform is an affinity.

Definition at line 438 of file Transform.h.

439  {
441  res.linear().noalias() = a*b.linear();
442  res.translation().noalias() = a*b.translation();
443  if (Mode!=int(AffineCompact))
444  res.matrix().row(Dim) = b.matrix().row(Dim);
445  return res;
446  }
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:220

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