Public Types | Public Member Functions | Static Public Attributes

TRTK::Transform3D< T > Class Template Reference

Affine or projective transformation in 3D. More...

#include <Transform3D.hpp>

List of all members.

Public Types

enum  Axis { X_AXIS, Y_AXIS, Z_AXIS }
enum  Plane { XY_PLANE, XZ_PLANE, YZ_PLANE }
enum  Unit { DEGREES, RADIANS }
enum  Error {
  DIVISION_BY_ZERO, INVALID_ARGUMENT, INVALID_AXIS, INVALID_UNIT,
  UNKNOWN_ERROR, WRONG_COORDINATE_SIZE
}
typedef T value_type
typedef Eigen::Matrix< T, 4, 4 > Matrix4T
typedef Eigen::Matrix< T, 4, 1 > Vector4T
typedef Eigen::Matrix< T, 3, 1 > Vector3T
typedef Coordinate< T > coordinate_type

Public Member Functions

 Transform3D ()
 Constructs an instance of Transform3D.
 Transform3D (const Matrix4T &)
 Constructs an instance of Transform3D.
 Transform3D (T a11, T a12, T a13, T a14, T a21, T a22, T a23, T a24, T a31, T a32, T a33, T a34, T a41, T a42, T a43, T a44)
 Constructs an instance of Transform3D.
 Transform3D (const Transform3D< T > &transform3D)
 Copy constructor.
template<class U >
 Transform3D (const Transform3D< U > &transform3D)
 Copy constructor.
virtual ~Transform3D ()
 Destroys the instance of Transform3D.
T & a11 ()
 Element access (readable and writable).
T & a12 ()
 Element access (readable and writable).
T & a13 ()
 Element access (readable and writable).
T & a14 ()
 Element access (readable and writable).
T & a21 ()
 Element access (readable and writable).
T & a22 ()
 Element access (readable and writable).
T & a23 ()
 Element access (readable and writable).
T & a24 ()
 Element access (readable and writable).
T & a31 ()
 Element access (readable and writable).
T & a32 ()
 Element access (readable and writable).
T & a33 ()
 Element access (readable and writable).
T & a34 ()
 Element access (readable and writable).
T & a41 ()
 Element access (readable and writable).
T & a42 ()
 Element access (readable and writable).
T & a43 ()
 Element access (readable and writable).
T & a44 ()
 Element access (readable and writable).
const T & a11 () const
 Read-only element access.
const T & a12 () const
 Read-only element access.
const T & a13 () const
 Read-only element access.
const T & a14 () const
 Read-only element access.
const T & a21 () const
 Read-only element access.
const T & a22 () const
 Read-only element access.
const T & a23 () const
 Read-only element access.
const T & a24 () const
 Read-only element access.
const T & a31 () const
 Read-only element access.
const T & a32 () const
 Read-only element access.
const T & a33 () const
 Read-only element access.
const T & a34 () const
 Read-only element access.
const T & a41 () const
 Read-only element access.
const T & a42 () const
 Read-only element access.
const T & a43 () const
 Read-only element access.
const T & a44 () const
 Read-only element access.
const Coordinate< T > operator* (const Coordinate< T > &) const
 Transforms a coordinate with the internally saved transformation.
const Matrix4T operator* (const Matrix4T &) const
 Composition of two transformations.
const Vector3T operator* (const Vector3T &) const
 Transforms a 3D vector with the internally saved transformation.
const Vector4T operator* (const Vector4T &) const
 Transforms a vector with the internally saved transformation.
const Transform3D operator* (const Transform3D &) const
 Composition of two transformations.
const Transform3D operator>> (const Transform3D &) const
 Composition of two transformations.
Transform3Doperator= (const Transform3D &)
 Copy assignment.
Matrix4T & getTransformationMatrix ()
 Returns the internal transformation matrix.
const Matrix4T & getTransformationMatrix () const
 Returns the internal transformation matrix.
const Transform3D inverse () const
 Returns the inverse transformation.
Transform3D orthographicProjection (const Plane=XY_PLANE) const
 Constructs an orthographic projection matrix.
Transform3D perspectiveProjection (const T distance, const Plane=XY_PLANE) const
 Constructs a perspective projection matrix.
Transform3Dreset ()
 Sets the internal matrix to the identity matrix.
Transform3Drotate (const double angle, const Axis=Z_AXIS, const Unit unit=RADIANS)
 Rotation around the x-, y-, or z-axis.
Transform3DrotateX (const double angle, const Unit unit=RADIANS)
 Rotation around the x-axis.
Transform3DrotateY (const double angle, const Unit unit=RADIANS)
 Rotation around the y-axis.
Transform3DrotateZ (const double angle, const Unit unit=RADIANS)
 Rotation around the z-axis.
Transform3DrotateAxis (const double angle, const Coordinate< T > &axis, const Unit unit=RADIANS)
 Rotation around an arbitrary axis.
Transform3DrotateAxis (const double angle, const Vector3T &axis, const Unit unit=RADIANS)
 Rotation around an arbitrary axis.
Transform3DrotateAxis (const double angle, const Vector4T &axis, const Unit unit=RADIANS)
 Rotation around an arbitrary axis.
Transform3Dscale (const T sx, const T sy, const T sz)
 Non-uniform scaling.
Transform3Dtranslate (const T dx, const T dy, const T dz)
 Translation.
Transform3Dtranslate (const Coordinate< T > &position)
 Translation.
bool is_affine () const
 Returns whether the internally saved transformation is affine or not.

Static Public Attributes

static const double pi = 3.14159265358979323846264338327950288419716939937510

Detailed Description

template<class T>
class TRTK::Transform3D< T >

Affine or projective transformation in 3D.

This class provides means to transform 3D coordinates via an affine or a projective transformation. The transformation can be composed from a sequence of elementary transformations such as translation, scaling, rotation etc. or by directly setting the entries of a \( 4 \times 4 \) transformation matrix. The coordinates may be given as 3D or as 4D coordinates in case of homogeneous coordinates.

The transformation is computed by multiplying a \( 4 \times 4 \) matrix with a 4D homogeneous coordinate followed by a potential normalization step. That is, if \( x \) is transformed to \( y \), first an intermediate vector \( w \) is computed

\[ \begin{pmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \end{pmatrix} = \begin{pmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ 1 \end{pmatrix} \]

followed by a normalization step

\[ \begin{pmatrix} y_1 \\ y_2 \\ y_3 \\ 1 \end{pmatrix} = \frac{1}{w_4} \begin{pmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \end{pmatrix} \]

In case of affine transformations

\[ y = Ax + b \]

or

\[ \begin{pmatrix} y_1 \\ y_2 \\ y_3 \\ 1 \end{pmatrix} = \begin{pmatrix} a_{11} & a_{12} & a_{13} & b_1 \\ a_{21} & a_{22} & a_{23} & b_2 \\ a_{31} & a_{32} & a_{33} & b_3 \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ 1 \end{pmatrix} \]

the subsequent normalization step can be omitted since the last entry of the above intermediate vector \( w \) would be \( 1 \) in any event.

Most functions check for certain assertions (e.g. if the coordinate size is valid) and trigger an assertion failure if the assumption does not hold. This is meant for debugging purposes only and can be disabled by defining the macro NDEBUG.

Here are some examples of how to use the Transform3D class:

Example 1:

 TRTK::Coordinate<double> coordinate(1, 4, 3);
 TRTK::Transform3D<double> transform;

 const double pi = transform::pi;
 transform.rotateZ(pi/2).translate(2, 0, 0);

 cout << transform * coordinate << endl;

Output:

 (-2, 1, 3)

Example 2:

 using namespace TRTK;

 Coordinate<double> coordinate(1, 4, 3);

 Transform3D<double> transform1;
 Transform3D<double> transform2;
 Transform3D<double> transform3;
 Transform3D<double> transform4;

 transform1.translate(1, 1, 0);

 // rotation of 90 degrees
 transform2.a11() =  0;
 transform2.a12() =  1;
 transform2.a21() = -1;
 transform2.a22() =  0;

 transform3.translate(-1, 0, 0);

 transform4 = transform3 * transform2 * transform1;

 cout << transform4 * coordinate << endl;

 transform4.reset() = transform1 >> transform2 >> transform3;

 cout << transform4 * coordinate << endl;

 cout << endl << transform4.getTransformationMatrix() << endl;

Output:

 (4, -2, 3)
 (4, -2, 3)

  0  1  0  0
 -1  0  0 -1
  0  0  1  0
  0  0  0  1
Note:
If you plan to use this class with an STL container, please have a look at this site.
See also:
Transform2D and Coordinate
Author:
Christoph Haenisch
Version:
0.5.0
Date:
last changed on 2013-04-04

Definition at line 208 of file Transform3D.hpp.


Constructor & Destructor Documentation

template<class T >
TRTK::Transform3D< T >::Transform3D (  )

Constructs an instance of Transform3D.

Template Parameters:
Tscalar type

The internal matrix is set to the identity matrix.

See also:
reset()

Definition at line 341 of file Transform3D.hpp.

template<class T >
TRTK::Transform3D< T >::Transform3D ( const Matrix4T &  matrix )

Constructs an instance of Transform3D.

Template Parameters:
Tscalar type
Parameters:
[in]matrixTranformation matrix.

Sets the internal matrix to the given matrix.

See also:
reset()

Definition at line 359 of file Transform3D.hpp.

template<class T>
TRTK::Transform3D< T >::Transform3D ( a11,
a12,
a13,
a14,
a21,
a22,
a23,
a24,
a31,
a32,
a33,
a34,
a41,
a42,
a43,
a44 
)

Constructs an instance of Transform3D.

Template Parameters:
Tscalar type

Sets the internal matrix to the given coefficients.

See also:
reset()

Definition at line 390 of file Transform3D.hpp.

template<class T>
TRTK::Transform3D< T >::Transform3D ( const Transform3D< T > &  transform3D )

Copy constructor.

Template Parameters:
Tscalar type
See also:
reset()

Definition at line 459 of file Transform3D.hpp.

template<class T >
template<class U >
TRTK::Transform3D< T >::Transform3D ( const Transform3D< U > &  transform3D )

Copy constructor.

Template Parameters:
Tscalar type of the newly created instance
Uscalar type of the copied instance
See also:
reset()

Definition at line 427 of file Transform3D.hpp.

template<class T >
TRTK::Transform3D< T >::~Transform3D (  ) [virtual]

Destroys the instance of Transform3D.

Template Parameters:
Tscalar type

Definition at line 501 of file Transform3D.hpp.


Member Function Documentation

template<class T >
T & TRTK::Transform3D< T >::a11 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{11} \).
See also:
reset()

Definition at line 517 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a11 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{11} \).
See also:
reset()

Definition at line 777 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a12 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{12} \).
See also:
reset()

Definition at line 533 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a12 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{12} \).
See also:
reset()

Definition at line 793 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a13 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{13} \).
See also:
reset()

Definition at line 809 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a13 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{13} \).
See also:
reset()

Definition at line 549 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a14 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{14} \).
See also:
reset()

Definition at line 565 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a14 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{14} \).
See also:
reset()

Definition at line 825 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a21 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{21} \).
See also:
reset()

Definition at line 581 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a21 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{21} \).
See also:
reset()

Definition at line 841 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a22 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{22} \).
See also:
reset()

Definition at line 857 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a22 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{22} \).
See also:
reset()

Definition at line 597 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a23 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{23} \).
See also:
reset()

Definition at line 873 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a23 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{23} \).
See also:
reset()

Definition at line 613 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a24 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{24} \).
See also:
reset()

Definition at line 629 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a24 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{24} \).
See also:
reset()

Definition at line 889 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a31 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{31} \).
See also:
reset()

Definition at line 645 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a31 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{31} \).
See also:
reset()

Definition at line 905 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a32 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{32} \).
See also:
reset()

Definition at line 661 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a32 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{32} \).
See also:
reset()

Definition at line 921 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a33 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{33} \).
See also:
reset()

Definition at line 677 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a33 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{33}\).
See also:
reset()

Definition at line 937 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a34 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{34} \).
See also:
reset()

Definition at line 693 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a34 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{34} \).
See also:
reset()

Definition at line 953 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a41 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{41} \).
See also:
reset()

Definition at line 709 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a41 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{41} \).
See also:
reset()

Definition at line 969 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a42 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{42} \).
See also:
reset()

Definition at line 726 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a42 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{42} \).
See also:
reset()

Definition at line 985 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a43 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{43} \).
See also:
reset()

Definition at line 1001 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a43 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{43} \).
See also:
reset()

Definition at line 743 of file Transform3D.hpp.

template<class T >
T & TRTK::Transform3D< T >::a44 (  )

Element access (readable and writable).

Template Parameters:
Tscalar type
Returns:
Reference to internal matrix element \( a_{44} \).
See also:
reset()

Definition at line 760 of file Transform3D.hpp.

template<class T >
const T & TRTK::Transform3D< T >::a44 (  ) const

Read-only element access.

Template Parameters:
Tscalar type
Returns:
Internal matrix element \( a_{44} \).
See also:
reset()

Definition at line 1017 of file Transform3D.hpp.

template<class T >
Transform3D< T >::Matrix4T & TRTK::Transform3D< T >::getTransformationMatrix (  )

Returns the internal transformation matrix.

Template Parameters:
Tscalar type
Returns:
Returns the internal transformation as 4x4 matrix representation.

Definition at line 1358 of file Transform3D.hpp.

template<class T >
const Transform3D< T >::Matrix4T & TRTK::Transform3D< T >::getTransformationMatrix (  ) const

Returns the internal transformation matrix.

Template Parameters:
Tscalar type
Returns:
Returns the internal transformation as 4x4 matrix representation.

Definition at line 1372 of file Transform3D.hpp.

template<class T >
const Transform3D< T > TRTK::Transform3D< T >::inverse (  ) const

Returns the inverse transformation.

Template Parameters:
Tscalar type
Returns:
A new copy.

Definition at line 1386 of file Transform3D.hpp.

template<class T >
bool TRTK::Transform3D< T >::is_affine (  ) const [inline]

Returns whether the internally saved transformation is affine or not.

Template Parameters:
Tscalar type
Returns:
Returns true, if the internal matrix is affine.

Definition at line 1906 of file Transform3D.hpp.

template<class T>
const Transform3D< T > TRTK::Transform3D< T >::operator* ( const Transform3D< T > &  transform ) const

Composition of two transformations.

Template Parameters:
Tscalar type
Parameters:
[in]transformA transformation described by Transform3D.
Returns:
A Transform3D object describing the composition of the two transformations.

This function computes the composition of the currently internally saved transformation with the transformation given by transform. Here, the composition is a simple matrix multiplication.

Example:

 typedef TRTK::Transform3D<double> Transform;

 Transform T1(1, 0, 0, 0,
              0, 1, 0, 1,
              0, 0, 2, 2,
              0, 0, 0, 1);

 Transform T2(1, 0, 0, 0,
              0, 2, 0, 3,
              0, 0, 2, 2,
              0, 0, 0, 1);

 Transform T3 = T1 * T2;

 std::cout << T3.getTransformationMatrix();

Output:

 1 0 0 0
 0 2 0 4
 0 0 4 6
 0 0 0 1
See also:
operator>>()

Definition at line 1286 of file Transform3D.hpp.

template<class T>
const Coordinate< T > TRTK::Transform3D< T >::operator* ( const Coordinate< T > &  coordinate ) const

Transforms a coordinate with the internally saved transformation.

Template Parameters:
Tscalar type
Parameters:
[in]coordinateCoordinate to be transformed. coordinate may be homogeneous.
Returns:
Transformed coordinate of the same size as the input coordinate.

The given coordinate must be of size three or four. If coordinate has a size of four (homogeneous coordinate), it is assumed that its fourth component is equal to one.

Example:

 TRTK::Coordinate<double> coordinate(1, 4, 3);
 TRTK::Transform3D<double> transform;

 transform.rotateZ(90).translate(2, 0, 0);

 cout << transform * coordinate << endl;

Output:

 (-2, 1, 3)

Definition at line 1055 of file Transform3D.hpp.

template<class T>
const Transform3D< T >::Matrix4T TRTK::Transform3D< T >::operator* ( const Matrix4T &  matrix ) const

Composition of two transformations.

Template Parameters:
Tscalar type
Parameters:
[in]matrix4x4 transformation matrix.
Returns:
4x4 transformation matrix.

This function computes the composition of the currently internally saved transformation with the transformation given by matrix. Here, the composition is a simple matrix multiplication.

Example:

 typedef TRTK::Transform3D<double> Transform;

 Transform T1(1, 0, 0, 0,
              0, 1, 0, 1,
              0, 0, 2, 2,
              0, 0, 0, 1);

 Transform::Matrix4T A;

 A << 1, 0, 0, 0,
      0, 2, 0, 3,
      0, 0, 2, 2,
      0, 0, 0, 1;

 Transform T2 = T1 * A;

 std::cout << T2.getTransformationMatrix();

Output:

 1 0 0 0
 0 2 0 4
 0 0 4 6
 0 0 0 1

Definition at line 1232 of file Transform3D.hpp.

template<class T>
const Transform3D< T >::Vector4T TRTK::Transform3D< T >::operator* ( const Vector4T &  vector ) const

Transforms a vector with the internally saved transformation.

Template Parameters:
Tscalar type
Parameters:
[in]vector4D vector to be transformed.
Returns:
Transformed 4D vector.

The vector is assumed to be a normalized homogeneous coordinate, i.e. its last component is assumed to be equal to one.

Example:

 TRTK::Transform3D<double> transform;
 TRTK::Transform3D<double>::Vector4T vec(1, 4, 3, 1);

 transform.rotateZ(90).translate(2, 0, 0);

 std::cout << transform * vec;

Output:

 -2
 1
 3
 1

Definition at line 1172 of file Transform3D.hpp.

template<class T>
const Transform3D< T >::Vector3T TRTK::Transform3D< T >::operator* ( const Vector3T &  vector ) const

Transforms a 3D vector with the internally saved transformation.

Template Parameters:
Tscalar type
Parameters:
[in]vector3D vector to be transformed.
Returns:
Transformed 3D vector.

Example:

 TRTK::Transform3D<double> transform;
 TRTK::Transform3D<double>::Vector3T vec(1, 4, 3);

 transform.rotateZ(90).translate(2, 0, 0);

 std::cout << transform * vec;

Output:

 -2
 1
 3

Definition at line 1123 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::operator= ( const Transform3D< T > &  transform3D )

Copy assignment.

Template Parameters:
Tscalar type
See also:
reset()

Definition at line 487 of file Transform3D.hpp.

template<class T >
const Transform3D< T > TRTK::Transform3D< T >::operator>> ( const Transform3D< T > &  transform ) const

Composition of two transformations.

Template Parameters:
Tscalar type
Parameters:
[in]transformA transformation described by Transform3D.
Returns:
A Transform3D object describing the composition of the two transformations.

This function computes the composition of the currently internally saved transformation with the transformation given by transform. Here, the composition is a simple matrix multiplication.

Example:

 typedef TRTK::Transform3D<double> Transform;

 Transform T1(1, 0, 0, 0,
              0, 1, 0, 1,
              0, 0, 2, 2,
              0, 0, 0, 1);

 Transform T2(1, 0, 0, 0,
              0, 2, 0, 3,
              0, 0, 2, 2,
              0, 0, 0, 1);

 Transform T3 = T1 >> T2; // == T2 * T1

 std::cout << T3.getTransformationMatrix();

Output:

 1 0 0 0
 0 2 0 5
 0 0 4 6
 0 0 0 1
See also:
operator*()

Definition at line 1341 of file Transform3D.hpp.

template<class T >
Transform3D< T > TRTK::Transform3D< T >::orthographicProjection ( const Plane  plane = XY_PLANE ) const

Constructs an orthographic projection matrix.

Template Parameters:
Tscalar type
Parameters:
[in]planeXY_PLANE, XZ_PLANE, or YZ_PLANE

Projects points to the x-y, x-z, or y-z plane. For example, in the case of projecting to the x-y plane, the coordinte (3, 1, 4) would be transformed to (3, 1, 0).

Warning:
WARNING: THIS METHOD MIGHT CHANGE, YET.
Returns:
Returns a projection matrix (and not *this!).
Todo:
Check whether this method corresponds to Bloomenthal's paper.

Definition at line 1410 of file Transform3D.hpp.

template<class T>
Transform3D< T > TRTK::Transform3D< T >::perspectiveProjection ( const T  distance,
const Plane  plane = XY_PLANE 
) const

Constructs a perspective projection matrix.

Template Parameters:
Tscalar type
Parameters:
[in]planeXY_PLANE, XZ_PLANE, or YZ_PLANE

The point of view is at the point of origin (0, 0, 0). Every point is projected on a plane with distance d to the point of origin, that is, for instance the origin of the xy-plane is (0, 0, d).

Warning:
WARNING: THIS METHOD MIGHT CHANGE, YET.
Returns:
Returns a projection matrix (and not *this!).
Todo:
Check whether this method corresponds to Bloomenthal's paper.

Definition at line 1459 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::reset (  )

Sets the internal matrix to the identity matrix.

Template Parameters:
Tscalar type
Returns:
*this

Definition at line 1509 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::rotate ( const double  angle,
const Axis  axis = Z_AXIS,
const Unit  unit = RADIANS 
)

Rotation around the x-, y-, or z-axis.

Template Parameters:
Tscalar type
Parameters:
[in]angleRotation angle.
[in]axisThe axis.
[in]unitRadian or degree.
Returns:
*this
See also:
rotateX(), rotateY() and rotateZ()

Definition at line 1532 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::rotateAxis ( const double  angle,
const Vector3T &  axis,
const Unit  unit = RADIANS 
)

Rotation around an arbitrary axis.

Template Parameters:
Tscalar type
Parameters:
[in]axisAxis to rotate around (need not to be normalized).
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1784 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::rotateAxis ( const double  angle,
const Vector4T &  axis,
const Unit  unit = RADIANS 
)

Rotation around an arbitrary axis.

Template Parameters:
Tscalar type
Parameters:
[in]axisAxis to rotate around (need not to be normalized).
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1803 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::rotateAxis ( const double  angle,
const Coordinate< T > &  axis,
const Unit  unit = RADIANS 
)

Rotation around an arbitrary axis.

Template Parameters:
Tscalar type
Parameters:
[in]axisAxis to rotate around (need not to be normalized).
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1718 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::rotateX ( const double  angle,
const Unit  unit = RADIANS 
)

Rotation around the x-axis.

Template Parameters:
Tscalar type
Parameters:
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1567 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::rotateY ( const double  angle,
const Unit  unit = RADIANS 
)

Rotation around the y-axis.

Template Parameters:
Tscalar type
Parameters:
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1617 of file Transform3D.hpp.

template<class T >
Transform3D< T > & TRTK::Transform3D< T >::rotateZ ( const double  angle,
const Unit  unit = RADIANS 
)

Rotation around the z-axis.

Template Parameters:
Tscalar type
Parameters:
[in]angleAngle in degrees or radian.
[in]unitThe unit of angle.
Returns:
*this

Definition at line 1667 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::scale ( const T  sx,
const T  sy,
const T  sz 
)

Non-uniform scaling.

Template Parameters:
Tscalar type
Parameters:
[in]sxScaling factor in x direction.
[in]syScaling factor in y direction.
[in]szScaling factor in z direction.

This function scales the axes of the currently internally saved transformation.

Returns:
*this

Definition at line 1825 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::translate ( const Coordinate< T > &  position )

Translation.

Template Parameters:
Tscalar type
Parameters:
[in]positionTranslation (must be a coordinate of size 3)

This function adds a translation to the currently stored transformation.

Returns:
*this

Definition at line 1881 of file Transform3D.hpp.

template<class T>
Transform3D< T > & TRTK::Transform3D< T >::translate ( const T  dx,
const T  dy,
const T  dz 
)

Translation.

Template Parameters:
Tscalar type
Parameters:
[in]dxTranslation in x direction.
[in]dyTranslation in y direction.
[in]dzTranslation in z direction.

This function adds a translation to the currently stored transformation.

Returns:
*this

Definition at line 1854 of file Transform3D.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines