next up previous contents index
Next: Point Generators ( point Up: Basic Data Types for Previous: Geometry Algorithms ( geo_alg   Contents   Index


Transformation ( TRANSFORM )

Definition

There are two instantiations of TRANSFORM. The instantiation with the rational kernel is called rat_transform and the instantiation with the floating point kernel is called transform.

An instance T of type TRANSFORM is an affine transformation of two-dimensional space. It is given by a 3 x 3 matrix T with T2, 0 = T2, 1 = 0 and T2, 2 $ \not=$ 0 and maps the point p with homogeneous coordinate vector (px, py, pw) to the point T*p.

A matrix of the form

$ \left( \begin{array}{ccc}
w & 0 & x \\
0 & w & y \\
0 & 0 & w
\end{array} \right) $
realizes an translation by the vector (x/w, y/w) and a matrix of the form

$ \left( \begin{array}{ccc}
a & -b & 0 \\
b & a & 0 \\
0 & 0 & w
\end{array} \right) $
where a2 + b2 = w2 realizes a rotation by the angle $ \alpha$ about the origin, where cos$ \alpha$ = a/w and sin$ \alpha$ = b/w. Rotations are in counter-clockwise direction.

There are two instantiations: transform for the floating point kernel and rat_transform for the rational kernel.

#include < LEDA/generic/TRANSFORM.h >

Creation

TRANSFORM T creates a variable introduces a variable T of type TRANSFORM. T is initialized with the identity transformation.

TRANSFORM T(const INT_MATRIX t) introduces a variable T of type TRANSFORM. T is initialized with the matrix t.
Precondition t is a 3 x 3 matrix with t2, 0 = t2, 1 = 0 and t2, 2 $ \not=$ 0.

Operations

INT_MATRIX T.T_matrix() returns the transformation matrix

void T.simplify() The operation has no effect for transform. For rat_transform let g be the ggT of all matrix entries. Cancels out g.

RAT_TYPE T.norm() returns the norm of the transformation

TRANSFORM T(TRANSFORM T1) returns the transformation ToT1.

POINT T(POINT p) returns T(p).

VECTOR T(VECTOR v) returns T(v).

SEGMENT T(SEGMENT s) returns T(s).

LINE T(LINE l) returns T(l ).

RAY T(RAY r) returns T(r).

CIRCLE T(CIRCLE C) returns T(C).

POLYGON T(POLYGON P) returns T(P).

GEN_POLYGON T(GEN_POLYGON P) returns T(P).

Non-member Functions

In any of the function below a point can be specified to the origin by replacing it by an anononymous object of type POINT, e.g., rotation90(POINT()) will generate a rotation about the origin.


TRANSFORM translation(INT_TYPE dx, INT_TYPE dy, INT_TYPE dw)
    returns the translation by the vector (dx/dw, dy/dw).

TRANSFORM translation(RAT_TYPE dx, RAT_TYPE dy)
    returns the translation by the vector (dx, dy).

TRANSFORM translation(VECTOR v) returns the translation by the vector v.

TRANSFORM rotation(POINT q, double alpha, double eps)
    returns the rotation about q by an angle alpha$ \pm$eps.

TRANSFORM rotation90(POINT q) returns the rotation about q by an angle of 90 degrees.

TRANSFORM reflection(POINT q, POINT r)
    returns the reflection across the straight line passing through q and r.

TRANSFORM reflection(POINT q) returns the reflection across point q.


next up previous contents index
Next: Point Generators ( point Up: Basic Data Types for Previous: Geometry Algorithms ( geo_alg   Contents   Index
LEDA research project
2000-02-09