Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
Transform Class Reference

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

List of all members.

Public Types

typedef Matrix< Scalar, Dim, Dim > LinearMatrixType
typedef Block< MatrixType, Dim,
Dim > 
LinearPart
typedef Matrix< Scalar, HDim,
HDim > 
MatrixType
typedef _Scalar Scalar
typedef Scaling< Scalar, Dim > ScalingType
typedef Block< MatrixType, Dim, 1 > TranslationPart
typedef Translation< Scalar, Dim > TranslationType
typedef Matrix< Scalar, Dim, 1 > VectorType

Public Member Functions

template<typename NewScalarType >
ei_cast_return_type< Transform,
Transform< NewScalarType, Dim >
>::type 
cast () 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
const Scalardata () const
Scalardata ()
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE (_Scalar, _Dim==Dynamic?Dynamic:(_Dim+1)*(_Dim+1)) enum
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
bool isApprox (const Transform &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
const LinearPart linear () const
LinearPart linear ()
const MatrixTypematrix () const
MatrixTypematrix ()
Scalar operator() (int row, int col) const
Scalaroperator() (int row, int col)
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
Transform operator* (const TranslationType &t) const
Transform operator* (const ScalingType &s) const
template<typename Derived >
Transform operator* (const RotationBase< Derived, Dim > &r) const
Transformoperator*= (const TranslationType &t)
Transformoperator*= (const ScalingType &s)
template<typename Derived >
Transformoperator*= (const RotationBase< Derived, Dim > &r)
Transformoperator= (const Transform &other)
template<typename OtherDerived >
Transformoperator= (const MatrixBase< OtherDerived > &other)
Transformoperator= (const QMatrix &other)
Transformoperator= (const QTransform &other)
Transformoperator= (const TranslationType &t)
Transformoperator= (const ScalingType &t)
template<typename Derived >
Transformoperator= (const RotationBase< Derived, Dim > &r)
template<typename RotationType >
Transformprerotate (const RotationType &rotation)
template<typename OtherDerived >
Transformprescale (const MatrixBase< OtherDerived > &other)
Transformprescale (Scalar s)
Transformpreshear (Scalar sx, Scalar sy)
template<typename OtherDerived >
Transformpretranslate (const MatrixBase< OtherDerived > &other)
template<typename RotationType >
Transformrotate (const RotationType &rotation)
LinearMatrixType rotation () const
template<typename OtherDerived >
Transformscale (const MatrixBase< OtherDerived > &other)
Transformscale (Scalar s)
void setIdentity ()
Transformshear (Scalar sx, Scalar sy)
QMatrix toQMatrix (void) const
QTransform toQTransform (void) const
 Transform ()
 Transform (const Transform &other)
 Transform (const TranslationType &t)
 Transform (const ScalingType &s)
template<typename Derived >
 Transform (const RotationBase< Derived, Dim > &r)
template<typename OtherDerived >
 Transform (const MatrixBase< OtherDerived > &other)
 Transform (const QMatrix &other)
 Transform (const QTransform &other)
template<typename OtherScalarType >
 Transform (const Transform< OtherScalarType, Dim > &other)
template<typename OtherDerived >
Transformtranslate (const MatrixBase< OtherDerived > &other)
const TranslationPart translation () const
TranslationPart translation ()

Static Public Member Functions

static const
MatrixType::IdentityReturnType 
Identity ()

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)

Detailed Description

Represents an homogeneous transformation in a N dimensional space.

This is defined in the Geometry module.

 #include <Eigen/Geometry> 
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

Member Typedef Documentation

typedef Matrix<Scalar,Dim,Dim> LinearMatrixType

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

typedef Block<MatrixType,Dim,Dim> LinearPart

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

typedef Matrix<Scalar,HDim,HDim> MatrixType

type of the matrix used to represent the transformation

typedef _Scalar Scalar

the scalar type of the coefficients

typedef Scaling<Scalar,Dim> ScalingType

corresponding scaling transformation type

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

corresponding translation type

typedef Matrix<Scalar,Dim,1> VectorType

type of a vector


Constructor & Destructor Documentation

Transform ( ) [inline]

Default constructor without initialization of the coefficients.

Transform ( const MatrixBase< OtherDerived > &  other) [inline, explicit]

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

Transform ( const QMatrix &  other) [inline]

Initialises *this from a QMatrix assuming the dimension is 2.

This function is available only if the token EIGEN_QT_SUPPORT is defined.

Transform ( const QTransform &  other) [inline]

Initialises *this from a QTransform assuming the dimension is 2.

This function is available only if the token EIGEN_QT_SUPPORT is defined.

Transform ( const Transform< OtherScalarType, Dim > &  other) [inline, explicit]

Copy constructor with scalar type conversion


Member Function Documentation

ei_cast_return_type<Transform,Transform<NewScalarType,Dim> >::type 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.

void 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.

Warning:
This is not considered to be part of the stable public API yet. Changes may happen in future releases. See Experimental parts of Eigen

This is defined in the SVD module.

 #include <Eigen/SVD> 
See also:
computeScalingRotation(), rotation(), class SVD
void 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.

Warning:
This is not considered to be part of the stable public API yet. Changes may happen in future releases. See Experimental parts of Eigen

This is defined in the SVD module.

 #include <Eigen/SVD> 
See also:
computeRotationScaling(), rotation(), class SVD
const Scalar* data ( ) const [inline]
Returns:
a const pointer to the column major internal matrix
Scalar* data ( ) [inline]
Returns:
a non-const pointer to the column major internal matrix
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

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.

const Transform< Scalar, Dim >::MatrixType inverse ( TransformTraits  traits = Affine) const [inline]
Warning:
This is not considered to be part of the stable public API yet. Changes may happen in future releases. See Experimental parts of Eigen
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()
bool isApprox ( const Transform 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()
const LinearPart linear ( ) const [inline]
Returns:
a read-only expression of the linear (linear) part of the transformation
LinearPart linear ( ) [inline]
Returns:
a writable expression of the linear (linear) part of the transformation
const MatrixType& matrix ( ) const [inline]
Returns:
a read-only expression of the transformation matrix
MatrixType& matrix ( ) [inline]
Returns:
a writable expression of the transformation matrix
Scalar operator() ( int  row,
int  col 
) const [inline]

shortcut for m_matrix(row,col);

See also:
MatrixBase::operaror(int,int) const
Scalar& operator() ( int  row,
int  col 
) [inline]

shortcut for m_matrix(row,col);

See also:
MatrixBase::operaror(int,int)
const ei_transform_product_impl<OtherDerived,_Dim,_Dim+1>::ResultType 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.
const Transform operator* ( const Transform other) const [inline]

Contatenates two transformations

Transform& operator= ( const MatrixBase< OtherDerived > &  other) [inline]

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

Transform< Scalar, Dim > & operator= ( const QMatrix &  other) [inline]

Set *this from a QMatrix assuming the dimension is 2.

This function is available only if the token EIGEN_QT_SUPPORT is defined.

Transform< Scalar, Dim > & operator= ( const QTransform &  other) [inline]

Set *this from a QTransform assuming the dimension is 2.

This function is available only if the token EIGEN_QT_SUPPORT is defined.

Transform< Scalar, Dim > & prerotate ( const RotationType &  rotation) [inline]

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()
Transform< Scalar, Dim > & prescale ( const MatrixBase< OtherDerived > &  other) [inline]

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()
Transform< Scalar, Dim > & 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)
Transform< Scalar, Dim > & 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()
Transform< Scalar, Dim > & pretranslate ( const MatrixBase< OtherDerived > &  other) [inline]

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

See also:
translate()
Transform< Scalar, Dim > & rotate ( const RotationType &  rotation) [inline]

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)
Transform< Scalar, Dim >::LinearMatrixType rotation ( ) const
Returns:
the rotation part of the transformation
Warning:
This is not considered to be part of the stable public API yet. Changes may happen in future releases. See Experimental parts of Eigen

This is defined in the SVD module.

 #include <Eigen/SVD> 
See also:
computeRotationScaling(), computeScalingRotation(), class SVD
Transform< Scalar, Dim > & scale ( const MatrixBase< OtherDerived > &  other) [inline]

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()
Transform< Scalar, Dim > & 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)
void setIdentity ( ) [inline]
Transform< Scalar, Dim > & 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()
QMatrix toQMatrix ( void  ) const [inline]
Returns:
a QMatrix from *this assuming the dimension is 2.
Warning:
this convertion might loss data if *this is not affine

This function is available only if the token EIGEN_QT_SUPPORT is defined.

QTransform toQTransform ( void  ) const [inline]
Returns:
a QTransform from *this assuming the dimension is 2.

This function is available only if the token EIGEN_QT_SUPPORT is defined.

Transform< Scalar, Dim > & translate ( const MatrixBase< OtherDerived > &  other) [inline]

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

See also:
pretranslate()
const TranslationPart translation ( ) const [inline]
Returns:
a read-only expression of the translation vector of the transformation
TranslationPart translation ( ) [inline]
Returns:
a writable expression of the translation vector of the transformation

Friends And Related Function Documentation

const ProductReturnType<OtherDerived,MatrixType>::Type operator* ( const MatrixBase< OtherDerived > &  a,
const Transform 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.

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