\( \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 4.6.1 - dD Geometry Kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Aff_transformation_d< Kernel > Class Template Reference

#include <CGAL/Kernel_d/Aff_transformation_d.h>

Definition

An instance of the data type Aff_transformation_d<Kernel> is an affine transformation of \( d\)-dimensional space.

It is specified by a square matrix \( M\) of dimension \( d + 1\). All entries in the last row of M except the diagonal entry must be zero; the diagonal entry must be non-zero. A point \( p\) with homogeneous coordinates \( (p[0], \ldots, p[d])\) can be transformed into the point p.transform(A) = \( Mp\), where A is an affine transformation created from M by the constructors below.

Implementation

Affine Transformations are implemented by matrices of number type RT as a handle type. All operations like creation, initialization, input and output on a transformation \( t\) take time \( O(t.dimension()^2)\). dimension() takes constant time. The operations for inversion and composition have the cubic costs of the used matrix operations. The space requirement is \( O(t.dimension()^2)\).

Types

typedef unspecified_type LA
 the linear algebra layer.
 
typedef unspecified_type Matrix
 the matrix type.
 

Creation

 Aff_transformation_d ()
 introduces some transformation.
 
 Aff_transformation_d (int d, Identity_transformation)
 introduces the identity transformation in \( d\)-dimensional space.
 
 Aff_transformation_d (Matrix M)
 introduces the transformation of \( d\)-space specified by matrix \( M\). More...
 
template<typename Forward_iterator >
 Aff_transformation_d (Scaling, Forward_iterator start, Forward_iterator end)
 introduces the transformation of \( d\)-space specified by a diagonal matrix with entries set [start,end) on the diagonal (a scaling of the space). More...
 
 Aff_transformation_d (Translation, Vector_d< Kernel > v)
 introduces the translation by vector \( v\).
 
 Aff_transformation_d (int d, Scaling, RT num, RT den)
 returns a scaling by a scale factor num/den. More...
 
 Aff_transformation_d (int d, Rotation, RT sin_num, RT cos_num, RT den, int e1=0, int e2=1)
 returns a planar rotation with sine and cosine values sin_num/den and cos_num/den in the plane spanned by the base vectors \( b_{e1}\) and \( b_{e2}\) in \( d\)-space. More...
 
 Aff_transformation_d (int d, Rotation, Direction_d< Kernel > dir, RT num, RT den, int e1=0, int e2=1)
 returns a planar rotation within a two-dimensional linear subspace. More...
 

Operations

int dimension ()
 the dimension of the underlying space
 
const Matrixmatrix ()
 returns the transformation matrix More...
 
Aff_transformation_d< Kernelinverse ()
 returns the inverse transformation. More...
 
Aff_transformation_d< Kerneloperator* (const Aff_transformation_d< Kernel > &s)
 composition of transformations. More...
 

Constructor & Destructor Documentation

template<typename Kernel >
CGAL::Aff_transformation_d< Kernel >::Aff_transformation_d ( Matrix  M)

introduces the transformation of \( d\)-space specified by matrix \( M\).

Precondition
M is a square matrix of dimension \( d + 1\) where entries in the last row of M except the diagonal entry must be zero; the diagonal entry must be non-zero.
template<typename Kernel >
template<typename Forward_iterator >
CGAL::Aff_transformation_d< Kernel >::Aff_transformation_d ( Scaling  ,
Forward_iterator  start,
Forward_iterator  end 
)

introduces the transformation of \( d\)-space specified by a diagonal matrix with entries set [start,end) on the diagonal (a scaling of the space).

Precondition
set [start,end) is a vector of dimension \( d+1\).
template<typename Kernel >
CGAL::Aff_transformation_d< Kernel >::Aff_transformation_d ( int  d,
Scaling  ,
RT  num,
RT  den 
)

returns a scaling by a scale factor num/den.

Precondition
den != 0.
template<typename Kernel >
CGAL::Aff_transformation_d< Kernel >::Aff_transformation_d ( int  d,
Rotation  ,
RT  sin_num,
RT  cos_num,
RT  den,
int  e1 = 0,
int  e2 = 1 
)

returns a planar rotation with sine and cosine values sin_num/den and cos_num/den in the plane spanned by the base vectors \( b_{e1}\) and \( b_{e2}\) in \( d\)-space.

Thus the default use delivers a planar rotation in the \( x\)- \( y\) plane.

Precondition
\( sin_num^2 + cos_num^2 = den^2\) and \( 0 \leq e_1 < e_2 < d\).
den != 0.
template<typename Kernel >
CGAL::Aff_transformation_d< Kernel >::Aff_transformation_d ( int  d,
Rotation  ,
Direction_d< Kernel dir,
RT  num,
RT  den,
int  e1 = 0,
int  e2 = 1 
)

returns a planar rotation within a two-dimensional linear subspace.

The subspace is spanned by the base vectors \( b_{e1}\) and \( b_{e2}\) in \( d\)-space. The rotation parameters are given by the \( 2\)-dimensional direction dir, such that the difference between the sines and cosines of the rotation given by dir and the approximated rotation are at most num/den each.

Precondition
dir.dimension() == 2, !dir.is_degenerate() and num < den is positive, den != 0, \( 0 \leq e_1 < e_2 < d\).

Member Function Documentation

template<typename Kernel >
Aff_transformation_d<Kernel> CGAL::Aff_transformation_d< Kernel >::inverse ( )

returns the inverse transformation.

Precondition
t.matrix() is invertible.
template<typename Kernel >
const Matrix& CGAL::Aff_transformation_d< Kernel >::matrix ( )

returns the transformation matrix

template<typename Kernel >
Aff_transformation_d<Kernel> CGAL::Aff_transformation_d< Kernel >::operator* ( const Aff_transformation_d< Kernel > &  s)

composition of transformations.

Note that transformations are not necessarily commutative. t*s is the transformation which transforms first by t and then by s.