5
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: Left-handed coordinate system: y z x x y z Reminder: Cross Product U V UxV VxU sin ˆ V U n V U x y y x z x x z y z z y z y x z y x v u v u v u v u v u v u v v v u u u z y x V U ˆ ˆ ˆ 3D Point Representation • A 3D point P is represented in homogeneous coordinates by a 4-dimensional vector: •As for 2D points: 1 z y x P z y x z y x p 1 3D Geometrical Transformations In homogeneous coordinates, 3D affine transformations are represented by 4x4 matrices: •A point transformation is performed: 1 0 0 0 z y x t i h g t f e d t c b a 1 1 0 0 0 1 ' ' ' z y x t i h g t f e d t c b a z y x z y x

Coordinate Systems

  • Upload
    v2

  • View
    165

  • Download
    2

Embed Size (px)

DESCRIPTION

Coordinate Systems

Citation preview

Page 1: Coordinate Systems

3D Geometrical TransformationsFoley & 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 SystemsRight-handed coordinate system:

Left-handed coordinate system:

y

z

x

x

y

z

Reminder: Cross Product

U

V

UxV

VxU

sinˆ VUnVU

xyyx

zxxz

yzzy

zyx

zyx

vuvuvuvuvuvu

vvvuuuzyx

VUˆˆˆ

3D Point Representation• A 3D point P is represented in homogeneous coordinates by a 4-dimensional vector:

•As for 2D points: 1zyx

P

zyx

zyx

p

1

3D Geometrical Transformations• In homogeneous coordinates, 3D affine transformations are represented by 4x4 matrices:

•A point transformation is performed:1000z

y

x

tihgtfedtcba

110001'''

zyx

tihgtfedtcba

zyx

z

y

x

Page 2: Coordinate Systems

3D TranslationP in translated to P' by:

Or:

Inverse:

11'''

11000100010001

z

y

x

z

y

x

tztytx

zyx

zyx

ttt

'PPT

y

z

x

PPT '1

3D Scaling

11'''

11000000000000

czbyax

zyx

zyx

cb

a

'PPSOr

PPS '1

y

z

x y

z

x

3D Reflection• A reflection through the xy plane:

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

111000010000100001

zyx

zyx

3D Shearing• Shearing:

• Change in each coordinate is a linear combination of all three• Transforms a cube into a general parallelepiped

111000010101

zfyexdzycxbzayx

zyx

fedcba

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

x

y

z

3D Rotation

• Counterclockwise rotation about x-axis

110000cossin00sincos00001

1'''

zyx

zyx

pRp x )('

y

z

x

Page 3: Coordinate Systems

3D Rotation

• Counterclockwise rotation about y-axis

110000cos0sin00100sin0cos

1'''

zyx

zyx

pRp y )('

y

z

x

3D Rotation

• Counterclockwise rotation about z-axis

1zyx

1000010000cossin00sincos

1'z'y'x

pRp z )('

yx

z

Composite Rotation• Rx, Ry, and Rz, can perform any rotationabout an axis passing through the origin

•Inverse rotation:

)(')(')(1 TRpRpRp

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

y

z

x

u=(ux,uy,uz)

v=(vx,vy,vz)

Change of Coordinates• Solution: M is rotation matrix whose rows are U,V, and W:

• Note: the inverse transformation is the transpose:

000

0 0 0 1

x y z

x y z

x y z

u u uv v v

Mw w w

10000wvu0wvu0wvu

MMzzz

yyy

xxx

T1

Change of Coordinates• Let's check the transformation of U under M:

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

X1001

100

uuu

1uuu

10000www0vvv0uuu

MU

2z

2y

2x

z

y

x

zyx

zyx

zyx

Page 4: Coordinate Systems

Change of Coordinates• Let's check the transformation of the X axis under M-1:

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

U

1uuu

1001

10000wvu0wvu0wvu

1001

Mz

y

x

zzz

yyy

xxx

1

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 , and then transform back

y

z

x

p1p2

Rotation About an Arbitrary Axis

z xp1

y

x

p1

y

xp1

z

z

step 1

Initial Position

Translate p1 to the Origin

step 2

Rotate p2 onto the z Axis

p2

p2

p2

xp1

z

step 3

Rotate the Object Around the z Axis

p2

x

p1

z

step 4

Rotate the Axis to the original Orientation

p2

y

z xp1

step 5

Translate to the Original Position

p2

y y

y

Rotation About an Arbitrary Axis• Step1:

• Step 2:

• Step 3:

• Step 4:

• Step 5:

• Composition:

1000z100y010x001

T1

1

1

10000www0vvv0uuu

Mzyx

zyx

zyx

1000010000cossin00sincos

R

10000wvu0wvu0wvu

Mzzz

yyy

xxx

1

1000z100y010x001

T1

1

11

PTMRMTP 11

Rotation About Arbitrary Axis• Constructing an orthonormal system along the rotation axis:

– A vector W parallel to the rotation axis:

– A vector V perpendicular to W:

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

ssw;pps 12

aavwa ;

100

wvu

Transforming Planes• Plane representation:

– By three non-collinear points– By implicit equation:

0

1

xy

A x B y C z D A B C Dz

P0

P1P2

1zyx

1DC

DB

DA

Page 5: Coordinate Systems

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: '

'' ' ' ' 0

'1

xy

A B C Dz

Transforming Planes• Note that:

• Thus, the transformation that we should apply to the plane equation is:

1 0

1

xy

A B C D T Tz

1A B C D A B C D T