# Geometrical Transformations Geometrical Transformations

Document Sample

```					 3D Geometrical Transformations                      3D Geometrical Transformations
Foley & Van Dam, Chapter 5
• 3D point representation
• Translation
• Scaling, reflection
• Shearing
• Rotations about x, y and z axis
• Composition of rotations
• Rotation about an arbitrary axis
• Transforming planes

3D Coordinate Systems                             Reminder: Cross Product
UxV

Right-handed coordinate system:
z                                                                                V

U

y                               VxU
x
Left-handed coordinate system:                             U           V                     ˆ
n U                     V           sin
y
ˆ
x           ˆ
y                 ˆ
z                       u       y v z     u    z  v y
U     V        u   x       u       y         u       z                   u       z v x      u    x v z
v   x       v       y         v       z                    u       x v y    u    y v x
z
x

3D Point Representation                      3D Geometrical Transformations
• A 3D point P is represented in homogeneous    • In homogeneous coordinates, 3D affine
coordinates by a 4-dimensional vector:          transformations are represented by 4x4 matrices:
x                                   a           b             c               t   x
y                                   d           e             f               t
P                                                                                             y
z
g           h             i               tz
1
0           0             0               1
•As for 2D points:                              •A point transformation is performed:
x           x
y           y                    x'              a                b               c           t   x         x
p                                            y '             d                e               f           t             y
z           z                                                                                     y

1                                z'                 g             h               i           t   z         z
1                  0             0               0               1         1
3D Translation                                                                            3D Scaling
a           0         0       0        x             x'                  ax
P in translated to P' by:                                                                                0           b         0       0        y             y '                 by
1   0       0       t   x       x           x'        x       t   x
0           0         c       0        z             z'                  cz
0   1       0       t   y       y           y '       y       t   y
0           0         0       1        1             1                    1
0   0       1       t   z       z           z'        z       t   z
0   0       0           1       1           1             1
Or                            S P                      P '

Or: T P                    P '                           z                                         z                                                    z

y                                           y                                                          y
x                                             x                                         x
1
Inverse: T             1
P '                 P                                                                             S             P '               P

3D Reflection                                                                         3D Shearing
• A reflection through the xy plane:                                                 • Shearing:
1      a    b               0         x                    x         ay               bz
c      1    d               0         y                    cx              y          dz
1        0               0           0             x                   x
e      f    1               0         z                    ex               fy          z
0        1               0           0             y                   y               0      0    0               1         1                                    1
0        0                   1       0             z                       z
0        0               0           1             1                   1       • Change in each coordinate is a linear combination of
all three
• Transforms a cube into a general parallelepiped
•Reflections through the xz and the yz planes are
defined similarly

3D Rotation                                                                           3D Rotation
• To generate a rotation in 3D we have to                                              • Counterclockwise rotation about x-axis
specify:                                                                                            x'        1                 0                0                   0         x
y '       0           cos                  sin                   0         y
– axis of rotation (2 d.o.f.)                                                                     z'        0           sin                cos                     0         z
– amount of rotation (1 d.o.f.)                                                                   1         0                 0                0                   1         1

•Note, the axis passes through the origin                                                                                 p '           R            (       ) p
x
y
z

z                                                                                                      y
x                                                                                         x
3D Rotation                                                                     3D Rotation
x'            cos               0            sin                  0   x          x '         cos                   sin                     0    0        x
y '               0             1              0                  0   y          y '          sin                cos                       0    0        y
z'              0                  0                      1    0        z
z'            sin               0           cos                   0   z                          0                  0                      0    1
1                                                                       1
1                 0             0              0                  1   1
p '       R    z   (           ) p
p '           R   y   (       ) p
z
z

y                                                                        y
x                                                                       x

Composite Rotation                                                               Change of Coordinates
• Rx, Ry, and Rz, can perform any rotation                                          • Problem: Given the XYZ orthonormal coordinate
about an axis passing through the origin                                            system, find a transformation M, that maps a
representation in XYZ into a representation in the
orthonormal system UVW, with the same origin
•Inverse rotation:                                                                  •The matrix M transforms the UVW vectors to the
XYZ vectors                  z
p    R 1( ) p' R(                                                ) p' RT ( )
u=(ux,uy,uz)
y
x
v=(vx,vy,vz)

Change of Coordinates                                                                 Change of Coordinates
• Solution: M is rotation matrix whose rows                                        • Let's check the transformation of U under M:
are U,V, and W:                                                                                     u x            u y            u z           0       u x
u    x         u   y           u   z         0                            v x            v y            v z           0       u y
MU
vx             v y             vz            0                            w x            w y            w z           0       u z
M
w x            w y             w z           0                             0              0              0            1        1
0              0               0            1
2
u            u 2            u   2
1
• Note: the inverse transformation is the                                                                  x          y               z
0
0                                         X
transpose:                                                                                                          0                               0
u x           v x             w             0                                    1                               1
x
1             T               u y           v y             w     y       0
M             M                                                                   • Similarly, V goes into Y, and W goes into Z
u z           v z             w     z       0
0             0               0            1
Change of Coordinates                                                                      Rotation About an Arbitrary Axis
• Let's check the transformation of the X axis                                                           • Axis of rotation can be located at any point:
under M-1:                                                                                               6 d.o.f. (we must specify 2 points p1 and p2)
1             u x              v x        w    x         0        1             u x              • The idea: make the axis coincident with
0             u y              v y        w              0        0             u y
M   1
0             u z              v z        w
y
0        0             u z
U   one of the coordinate axes (z axis), rotate by
z
1                                                                 1
0                0          0             1                       1                 , and then transform back
z
p2
p1
• Similarly, Y goes into V, and Z goes into W

y
x

1       0           0              x
y
step 3 y
1

• Step1:              T
0       1           0              y      1

p1 p2                                 p2 p1
0
0
0
0
1
0             1
z      1

x                                                        x
z       Initial Position                                 z
u x             u y             u z               0
Rotate the Object               • Step 2:             M
v x             v y             v z               0
Around the z Axis                                                 w x             w y             w z               0
y                                                       y                                                             0               0               0                1
p1                                  step 4             p1
step 1                         p2                                                   p2                                             cos                      sin                          0        0
• Step 3:             R             sin                   cos                           0        0
x                                             x                                                  0                        0                         1        0
z                                                        z Rotate the Axis to the                                                 0                        0                         0        1
Translate p    1   to the Origin                                                                                               u x         v x             w                 0
original Orientation                                              u y         v y             w
x
0
• Step 4:         M       1
u z         v z             w
y
0
z
y                                                      y                                                             0           0               0                1

step 2        p1                                       step 5                  p1     p2                                           1       0           0           x 1
0       1           0           y 1
• Step 5:         T       1

x                                                  x
0       0           1           z1
z p2                                                 z        Translate to the
0       0
1
0            1
1
Rotate p2 onto the z Axis
Original Position
• Composition: P                      T                   M                     R M T P

Rotation About Arbitrary Axis                                                                                  Transforming Planes
• Constructing an orthonormal system along the
rotation axis:                                                                                           • Plane representation:
– A vector W parallel to the rotation axis:                                                              – By three non-collinear points
s                         – By implicit equation:                                                                           x
s             p    2             p 1;                    w
s                                                                                                                           y
A x      B y   C z             D               A               B             C                D        0
– A vector V perpendicular to W:                                                                                                                                                                           z
0                                                                            A           B       C                                                               1
a                                                                            1
a           w          0            ;    v                                                          D           D       D
a
1
P1
– A vector U forming a right-handed orthogonal system                                                                                                                                                 P2
with W and V:
x           y       z         1
u                 v                 w                                                      P0
Transforming Planes                                     Transforming Planes
• One way to transform a plane is by transforming       • Note that:                                  x
any three non-collinear points on the plane
1       y
A       B       C       D   T       T           0
z
• Another way is to transform the plane equation:
Given a transformation T such that                                                                    1

T [x, y, z, 1] = [x', y', z', 1]         • Thus, the transformation that we should
find [A',B',C',D'], such that:                          apply to the plane equation is:
x '
1
A '     B '     C '       D '
y '
0
A       B       C       D       A   B       C   D       T
z '
1

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 19 posted: 3/29/2011 language: English pages: 5
How are you planning on using Docstoc?