\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 5.0 - 2D and 3D Linear Geometry Kernel
CGAL::Aff_transformation_3< Kernel > Class Template Reference

#include <CGAL/Aff_transformation_3.h>

Definition

The class Aff_transformation_3 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\times 4\) matrix \( {(m_{ij})}_{i,\,j=0\ldots 3}\). Entries \( m_{30}\), \( m_{31}\), and \( m_{32}\) are always zero and therefore do not appear in the constructors.

Is Model Of:
Hashable if Kernel is a cartesian kernel and if Kernel::FT is Hashable
See also
CGAL::Aff_transformation_2<Kernel>
CGAL::Identity_transformation
CGAL::Reflection
CGAL::Rotation
CGAL::Scaling
CGAL::Translation

Creation

 Aff_transformation_3 (const Identity_transformation &)
 introduces an identity transformation.
 
 Aff_transformation_3 (const Translation, const Vector_3< Kernel > &v)
 introduces a translation by a vector v.
 
 Aff_transformation_3 (const Scaling, const Kernel::RT &s, const Kernel::RT &hw=RT(1))
 introduces a scaling by a scale factor \( s/hw\).
 
 Aff_transformation_3 (const Kernel::RT &m00, const Kernel::RT &m01, const Kernel::RT &m02, const Kernel::RT &m03, const Kernel::RT &m10, const Kernel::RT &m11, const Kernel::RT &m12, const Kernel::RT &m13, const Kernel::RT &m20, const Kernel::RT &m21, const Kernel::RT &m22, const Kernel::RT &m23, const Kernel::RT &hw=RT(1))
 introduces a general affine transformation of the matrix form \( \small \mbox{\(\left(\begin{array}{cccc} m_{00} & m_{01} & m_{02} & m_{03}\\ m_{10} & m_{11} & m_{12} & m_{13}\\ m_{20} & m_{21} & m_{22} & m_{23}\\ 0 & 0 & 0 & hw \end{array}\right)\)} \). More...
 
 Aff_transformation_3 (const Kernel::RT &m00, const Kernel::RT &m01, const Kernel::RT &m02, const Kernel::RT &m10, const Kernel::RT &m11, const Kernel::RT &m12, const Kernel::RT &m20, const Kernel::RT &m21, const Kernel::RT &m22, const Kernel::RT &hw=RT(1))
 introduces a general linear transformation of the matrix form \( \small \mbox{\(\left(\begin{array}{cccc} m_{00} & m_{01} & m_{02} & 0\\ m_{10} & m_{11} & m_{12} & 0\\ m_{20} & m_{21} & m_{22} & 0\\ 0 & 0 & 0 & hw \end{array}\right)\)} \), i.e. an affine transformation without translational part.
 

Operations

The main thing to do with transformations is to apply them on geometric objects.

Each class Class_3<Kernel> representing a geometric object 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. The same functionality is also available through operator() overloads.

Point_3< Kerneltransform (const Point_3< Kernel > &p) const
 
Vector_3< Kerneltransform (const Vector_3< Kernel > &p) const
 
Direction_3< Kerneltransform (const Direction_3< Kernel > &p) const
 
Plane_3< Kerneltransform (const Plane_3< Kernel > &p) const
 
Point_3< Kerneloperator() (const Point_3< Kernel > &p) const
 
Vector_3< Kerneloperator() (const Vector_3< Kernel > &p) const
 
Direction_3< Kerneloperator() (const Direction_3< Kernel > &p) const
 
Plane_3< Kerneloperator() (const Plane_3< Kernel > &p) const
 
Aff_transformation_3< Kerneloperator* (const Aff_transformation_3< Kernel > &s) const
 composes two affine transformations.
 
Aff_transformation_3< Kernelinverse () const
 gives the inverse transformation.
 
bool operator== (const Aff_transformation_3< Kernel > &s) const
 compares two affine transformations.
 
bool is_even () const
 returns true, if the transformation is not reflecting, i.e. the determinant of the involved linear transformation is non-negative.
 
bool is_odd () const
 returns true, if the transformation is reflecting.
 

Matrix Entry Access

Kernel::FT cartesian (int i, int j) const
 
Kernel::FT m (int i, int j) const
 returns entry \( m_{ij}\) in a matrix representation in which \( m_{33}\) is 1.
 
Kernel::RT homogeneous (int i, int j) const
 
Kernel::RT hm (int i, int j) const
 returns entry \( m_{ij}\) in some fixed matrix representation.
 

Constructor & Destructor Documentation

◆ Aff_transformation_3()

template<typename Kernel >
CGAL::Aff_transformation_3< Kernel >::Aff_transformation_3 ( const Kernel::RT m00,
const Kernel::RT m01,
const Kernel::RT m02,
const Kernel::RT m03,
const Kernel::RT m10,
const Kernel::RT m11,
const Kernel::RT m12,
const Kernel::RT m13,
const Kernel::RT m20,
const Kernel::RT m21,
const Kernel::RT m22,
const Kernel::RT m23,
const Kernel::RT hw = RT(1) 
)

introduces a general affine transformation of the matrix form \( \small \mbox{\(\left(\begin{array}{cccc} m_{00} & m_{01} & m_{02} & m_{03}\\ m_{10} & m_{11} & m_{12} & m_{13}\\ m_{20} & m_{21} & m_{22} & m_{23}\\ 0 & 0 & 0 & hw \end{array}\right)\)} \).

The part \(1\over hw\) \( \small \mbox{\(\left(\begin{array}{ccc} m_{00} & m_{01} & m_{02}\\ m_{10} & m_{11} & m_{12}\\ m_{20} & m_{21} & m_{22}\\ \end{array}\right)\)} \) defines the scaling and rotational part of the transformation, while the vector \(1\over hw\) \(\small \mbox{\(\left(\begin{array}{c} m_{03}\\ m_{13}\\ m_{23} \end{array}\right)\)}\) contains the translational part.