3D Geometrical Transformations - Brandeis University

3D Geometrical Transformations

Foley & Van Dam, Chapter 5

3D Geometrical Transformations

? 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

Right-handed coordinate system: z

y x Left-handed coordinate system:

y

z x

Reminder: Cross Product

UxV

VxU

U uV

V

T

U

n^ U V sin T

U uV

x^

y^

z^

ux

uy

uz

vx

vy

vz

?u ?

yv

z

?u zv x

u

zv

y

? ?

u xvz ?

?? u x v y u y v x ??

3D Point Representation

? A 3D point P is represented in homogeneous

coordinates by a 4-dimensional vector:

? x?

P

? ?

y

? ?

?z?

? ?

1

? ?

?As for 2D points:

p

? x ? ?D x ?

? ?

y

? ?

?z?

{

? ?

D

y

? ?

?D z ?

? ?

1

? ?

? ?

D

? ?

3D Geometrical Transformations

? In homogeneous coordinates, 3D affine

transformations are represented by 4x4 matrices:

?a b c tx ?

? ?

d

e

f

t

y

? ?

?g

? ?

0

h 0

i 0

tz 1

? ? ?

?A point transformation is performed:

? x '? ? a b c t x ? ? x ?

? ?

y

'

? ?

? ?

d

e

f

t

y

? ?

? ?

y

? ?

? z '?

? ?

1

? ?

?g

? ?

0

h 0

i 0

tz 1

? ? ?

?z

? ?

1

? ? ?

3D Translation

P in translated to P' by:

?1 0

? ?

0

1

?0 0

? ?

0

0

0 tx ?? x ?

0

t

y

? ?

? ?

y

? ?

1 0

tz 1

?? z

? ?

? ?

1

? ? ?

? x '?

? ?

y

'

? ?

? z '?

? ?

1

? ?

? x tx ?

? ?

y

ty

? ?

? ? ?

z

tz 1

? ? ?

Or: T P P '

z

y x

Inverse: T 1 P ' P

3D Reflection

? A reflection through the xy plane:

?1 0

0

0??x? ? x ?

? ?

0

1

0

0

? ?

? ?

y

? ?

? ?

y

? ?

?0 0 1 0 ? ? z ? ? z ?

? ?

0

0

0

1

? ?

? ?

1

? ?

? ?

1

? ?

?Reflections through the xz and the yz planes are defined similarly

3D Scaling

? a 0 0 0 ? ? x ? ? x ' ? ? ax ?

? ?

0

b

0

0

? ?

? ?

y

? ?

? ?

y

'

? ?

? ?

by

? ?

? 0 0 c 0 ? ? z ? ? z ' ? ? cz ?

? ?

0

00

1

? ?

? ?

1

? ?

? ?

1

? ?

? ?

1

? ?

Or

S P P'

z

z

x

yx

y

S 1P ' P

3D Shearing

? Shearing:

? 1 a b 0 ? ? x ? ? x ay bz ?

? ?

c

1

d

0

? ?

? ?

y

? ?

? ?

cx

y

dz

? ?

? e f 1 0 ? ? z ? ? ex fy 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

3D Rotation

? To generate a rotation in 3D we have to specify:

? axis of rotation (2 d.o.f.) ? amount of rotation (1 d.o.f.)

?Note, the axis passes through the origin

y

z x

3D Rotation

? Counterclockwise rotation about x-axis

? x '?

? ?

y

'

? ?

? z '?

? ?

1

? ?

?1

0

? ?

0

cos T

? 0 sin T

? ?

0

0

0 sin T cos T

0

0??x?

0

? ?

? ?

y

? ?

0?? z ?

1

? ?

? ?

1

? ?

p ' R x (T ) p

z

y x

3D Rotation

? Counterclockwise rotation about y-axis

? x '?

? ?

y

'

? ?

? z '?

? ?

1

? ?

? cos T

? ?

0

? sin T

? ?

0

0 sin T

1

0

0 cos T

0

0

0??x?

0

? ?

? ?

y

? ?

0?? z ?

1

? ?

? ?

1

? ?

p ' R y (T ) p z

y x

3D Rotation

? Counterclockwise rotation about z-axis

? x '? ? y '? ? z '? ?? 1 ??

? cos sin 0 0 ? ? x ?

? sin

cos

0 0 ??y ?

?0

0

1 0 ??z ?

?? 0

0

0 1 ?? ?? 1 ??

p ' R z (T ) p

z

y x

Composite Rotation

? Rx, Ry, and Rz, can perform any rotation about an axis passing through the origin

?Inverse rotation:

p R 1 (T ) p ' R (T ) p ' R T (T )

Change of Coordinates

? Solution: M is rotation matrix whose rows

are U,V, and W:

?ux

uy

uz

0?

M

? ?

v

x

vy

vz

0

? ?

? ? ?

w 0

x

wy 0

wz 0

0?

1

? ?

? Note: the inverse transformation is the

transpose:

M 1

MT

?u x

vx

wx

0?

?u

? ?

u

y z

vy vz

wy wz

0?

0

? ?

?? 0

0

0

1 ??

Change of Coordinates

? Problem: Given the XYZ orthonormal coordinate

system, find a transformation M, that maps a representation in XYZ into a representation in the orthonormal system UVW, with the same origin

?The matrix M transforms the UVW vectors to the

XYZ vectors

z

u=(ux,uy,uz) x

y v=(vx,vy,vz)

Change of Coordinates

? Let's check the transformation of U under M:

MU

? ux

? ?

v

x

?w x

uy vy wy

uz vz wz

0 0 0

? ? ? ?

?u

?u

? ?

u

x y z

? ? ? ?

?? 0

0

0

1 ?? ?? 1 ??

?u ?

2 x

?

? ?

u

2 y

0

0

1

u

2 z

? ?

?

? ?

?1? ?0 ? ?0 ? ?? 1 ??

X

? Similarly, V goes into Y, and W goes into Z

Change of Coordinates

? Let's check the transformation of the X axis under M-1:

?1?

M

1 ?0 ?0

? ?

?? 1 ??

?u x

?u

? ?

u

y z

?? 0

vx vy

vz 0

wx wy

wz 0

0 0

0 1

? ? ? ? ??

? ? ? ??

1 0 0 1

? ? ? ??

?u x ?

?u

? ?

u

y z

? ? ?

?? 1 ??

U

? Similarly, Y goes into V, and Z goes into W

Rotation About an Arbitrary Axis

y

p1 p2

z

x

Initial Position

y

step 1

p1 p2

z

x

Translate p1 to the Origin

step 3 y

p2 p1

x

z Rotate the Object

Around the z Axis

y

step 4

p1 p2

z

Rotate

the

Axis

to

x

the

original Orientation

y

step 2 p1

z p2

x

Rotate p2 onto the z Axis

step 5

z

y

p1 p2

x

Translate to the Original Position

Rotation About Arbitrary Axis

? Constructing an orthonormal system along the

rotation axis:

? A vector W parallel to the rotation axis:

s p 2 p 1;

w

s

s

? A vector V perpendicular to W:

a

w

u

?? ?

0 0

?? ?

;v

?? 1 ??

a a

? A vector U forming a right-handed orthogonal system with W and V:

u vuw

Rotation About an Arbitrary Axis

? Axis of rotation can be located at any point: 6 d.o.f. (we must specify 2 points p1 and p2) ? The idea: make the axis coincident with one of the coordinate axes (z axis), rotate by T, and then transform back

z

p1

p2

y x

Rotation About an Arbitrary Axis

? Step1:

T

?? ?

1 0

0 1

0 0

x y

1 1

?? ?

???

0 0

0 0

1 0

z 1

1

???

? Step 2:

M

?? ?

u v

x x

uy vy

uz vz

0 0

?? ?

? ??

wx 0

wy 0

wz 0

0? 1 ??

? Step 3:

R

? Step 4:

M 1

? Step 5:

T 1

? Composition: P c

?? ? ??

cos sin

0

0

sin cos

0 0

0 0 1 0

0 0 0 1

?? ? ??

?? ?

u u

x y

vx vy

wx wy

0 0

?? ?

???

uz 0

vz 0

wz 0

0 1

???

?? ?

1 0

0 1

0 0

x y

1 1

?? ?

???

0 0

0 0

1 0

z1 1

???

T 1 M 1 R M T P

Transforming Planes

? Plane representation:

? By three non-collinear points

? By implicit equation: A x B y C z D >A

?A ?? D

B D

C D

1???

BC

?x?

D@

? ?

y

? ?

?z?

0

? ?

1

? ?

P1 P2

>x y z 1@

P0

Transforming Planes

? One way to transform a plane is by transforming

any three non-collinear points on the plane

? Another way is to transform the plane equation: Given a transformation T such that

T [x, y, z, 1] = [x', y', z', 1]

find [A',B',C',D'], such that:

? x '?

>A '

B'

C'

D

' @

? ?

y

'

? ?

? z '?

0

? ?

1

? ?

Transforming Planes

? Note that:

?x?

>A

BC

D @ T 1T

? ?

y

? ?

?z?

0

? ?

1

? ?

? Thus, the transformation that we should

apply to the plane equation is:

> Ac Bc Cc Dc@ > A B C @D T 1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download