CGAL::Aff_transformation_3<Kernel>

Definition

The class Aff_transformation_3<Kernel> represents three-dimensional affine transformations. The general form of an affine transformation is based on a homogeneous representation of points. Thereby all transformations can be realized by matrix multiplication.

Multiplying the transformation matrix by a scalar does not change the represented transformation. Therefore, any transformation represented by a matrix with rational entries can be represented by a transformation matrix with integer entries as well. (Multiply the matrix with the common denominator of the rational entries.) Hence, it is sufficient to use the number type Kernel::RT to represent the entries of the transformation matrix.

CGAL offers several specialized affine transformations. Different constructors are provided to create them. They are parameterized with a symbolic name to denote the transformation type, followed by additional parameters. The symbolic name tags solve ambiguities in the function overloading and they make the code more readable, i.e., what type of transformation is created.

In three-dimensional space we have a 4 × 4 matrix (mij)i,j=0...3. Entries m30, m31, and m32 are always zero and therefore do not appear in the constructors.

Creation

Aff_transformation_3<Kernel> t ( Identity_transformation);
introduces an identity transformation.


Aff_transformation_3<Kernel> t ( const Translation, Vector_3<Kernel> v);
introduces a translation by a vector v.


Aff_transformation_3<Kernel> t ( const Scaling, Kernel::RT s, Kernel::RT hw = RT(1));
introduces a scaling by a scale factor s/hw.

Aff_transformation_3<Kernel> t ( Kernel::RT m00,
Kernel::RT m01,
Kernel::RT m02,
Kernel::RT m03,
Kernel::RT m10,
Kernel::RT m11,
Kernel::RT m12,
Kernel::RT m13,
Kernel::RT m20,
Kernel::RT m21,
Kernel::RT m22,
Kernel::RT m23,
Kernel::RT hw = RT(1));
introduces a general affine transformation of the matrix form . The part hw-1 defines the scaling and rotational part of the transformation, while the vector hw-1 contains the translational part.

Aff_transformation_3<Kernel> t ( Kernel::RT m00,
Kernel::RT m01,
Kernel::RT m02,
Kernel::RT m10,
Kernel::RT m11,
Kernel::RT m12,
Kernel::RT m20,
Kernel::RT m21,
Kernel::RT m22,
Kernel::RT hw = RT(1));
introduces a general linear transformation of the matrix form , i.e. an affine transformation without translational part.

Operations

Each class Class_3<Kernel> representing a geometric object in 3D has a member function:

Class_3<Kernel> transform(Aff_transformation_3<Kernel> t).

The transformation classes provide a member function transform() for points, vectors, directions, and planes:

Point_3<Kernel> t.transform ( Point_3<Kernel> p)
Vector_3<Kernel> t.transform ( Vector_3<Kernel> p)
Direction_3<Kernel> t.transform ( Direction_3<Kernel> p)
Plane_3<Kernel> t.transform ( Plane_3<Kernel> p)

CGAL provides four function operators for these member functions:

Point_3<Kernel> t.operator() ( Point_3<Kernel> p)
Vector_3<Kernel> t.operator() ( Vector_3<Kernel> p)
Direction_3<Kernel> t.operator() ( Direction_3<Kernel> p)
Plane_3<Kernel> t.operator() ( Plane_3<Kernel> p)

Aff_transformation_3<Kernel> t.operator* ( s) composes two affine transformations.

Aff_transformation_3<Kernel> t.inverse () gives the inverse transformation.

bool t.is_even () returns true, if the transformation is not reflecting, i.e. the determinant of the involved linear transformation is non-negative.

bool t.is_odd () returns true, if the transformation is reflecting.

The matrix entries of a matrix representation of a Aff_transformation_3<Kernel> can be accessed trough the following member functions:

Kernel::FT t.cartesian ( int i, int j)
Kernel::FT t.m ( int i, int j) returns entry mij in a matrix representation in which m33 is 1.

Kernel::RT t.homogeneous ( int i, int j)
Kernel::RT t.hm ( int i, int j) returns entry mij in some fixed matrix representation.

For affine transformations no I/O operators are defined.

See Also

CGAL::Aff_transformation_2<Kernel>
CGAL::Identity_transformation
CGAL::Reflection
CGAL::Rotation
CGAL::Scaling
CGAL::Translation