31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

14.25 Transformation ( TRANSFORM )<br />

1. Definition<br />

<strong>The</strong>re are three instantiations of TRANSFORM : transform (floating point kernel),<br />

rat transform (rational kernel) and real transform (real kernel). <strong>The</strong> respective header<br />

file name corresponds to the type name (with “.h” appended).<br />

An instance T of type TRANSFORM is an affine transformation of two-dimensional<br />

space. It is given by a 3 × 3 matrix T with T 2,0 = T 2,1 = 0 and T 2,2 ≠ 0 and maps the<br />

point p with homogeneous coordinate vector (p x , p y , p w ) to the point T · p.<br />

A matrix of the form<br />

⎛<br />

⎜<br />

⎝<br />

w 0 x<br />

0 w y<br />

0 0 w<br />

realizes an translation by the vector (x/w, y/w) and a matrix of the form<br />

⎛<br />

⎜<br />

⎝<br />

a −b 0<br />

b a 0<br />

0 0 w<br />

where a 2 + b 2 = w 2 realizes a rotation by the angle α about the origin, where cos α = a/w<br />

and sin α = b/w. Rotations are in counter-clockwise direction.<br />

#include < <strong>LEDA</strong>/geo/generic/TRANSFORM.h ><br />

2. Creation<br />

TRANSFORM T ; creates a variable introduces a variable T of type TRANSFORM .<br />

T is initialized with the identity transformation.<br />

⎞<br />

⎟<br />

⎠<br />

⎞<br />

⎟<br />

⎠<br />

TRANSFORM<br />

T (const INT MATRIX t);<br />

introduces a variable T of type TRANSFORM . T is initialized with<br />

the matrix t.<br />

Precondition: t is a 3 × 3 matrix with t 2,0 = t2, 1 = 0 and t 2,2 ≠ 0.<br />

3. Operations<br />

INT MATRIX T.T matrix( )<br />

returns the transformation matrix<br />

void T.simplify( ) <strong>The</strong> operation has no effect for transform. For<br />

rat transform let g be the ggT of all matrix entries.<br />

Cancels out g.<br />

RAT TYPE T.norm( )<br />

returns the norm of the transformation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!