35
3-D Geometric Transformations Some of the material in these slides may have been adapted from the lecture notes of Graphics Lab @ Korea University

3-D Geometric Transformations

  • Upload
    kateb

  • View
    76

  • Download
    2

Embed Size (px)

DESCRIPTION

3-D Geometric Transformations. Some of the material in these slides may have been adapted from the lecture notes of Graphics Lab @ Korea University. Contents. Translation Scaling Rotation Other Transformations Coordinate Transformations. Transformation in 3D. Transformation Matrix. - PowerPoint PPT Presentation

Citation preview

Page 1: 3-D Geometric Transformations

3-D GeometricTransformations

Some of the material in these slides may have been adapted from the lecture notes of Graphics Lab @ Korea University

Page 2: 3-D Geometric Transformations

2

Contents

● Translation● Scaling ● Rotation● Other Transformations● Coordinate Transformations

Page 3: 3-D Geometric Transformations

3

Transformation in 3D

● Transformation Matrix

1131

1333

000 SLIFCKHEBJGDA

33 : Scaling, Reflection, Shearing, Rotation31 : Translation

13 : Homogeneous representation11 : Uniform global Scaling

Page 4: 3-D Geometric Transformations

4

3D Translation

● Translation of a Point

zyx tzztyytxx ',','

11000100010001

1'''

zyx

ttt

zyx

z

y

x

xz

y

Page 5: 3-D Geometric Transformations

5

3D Scaling

● Uniform Scaling

zyx szzsyysxx ',','

11000000000000

1'''

zyx

ss

s

zyx

z

y

x

xz

y

Page 6: 3-D Geometric Transformations

6

Relative Scaling

● Scaling with a Selected Fixed Position

11000100010001

1000000000000

1000100010001

1'''

),,(),,(),,(zyx

zyx

ss

s

zyx

zyx

zyxTsssSzyxTf

f

f

z

y

x

f

f

f

fffzyxfff

x x x xzzzz

y y y y

Original position Translate Scaling Inverse Translate

Page 7: 3-D Geometric Transformations

7

3D Rotation

● Coordinate-Axes Rotations■ X-axis rotation■ Y-axis rotation■ Z-axis rotation

● General 3D Rotations■ Rotation about an axis that is parallel to one of the

coordinate axes■ Rotation about an arbitrary axis

Page 8: 3-D Geometric Transformations

8

Rotation is counterclockwise

Page 9: 3-D Geometric Transformations

9

Coordinate-Axes Rotations

Z-Axis Rotation ● X-Axis Rotation ● Y-Axis Rotation

11000010000cossin00sincos

1'''

zyx

zyx

z

y

x

110000cossin00sincos00001

1'''

zyx

zyx

110000cos0sin00100sin0cos

1'''

zyx

zyx

z

y

xz

y

x

Page 10: 3-D Geometric Transformations

10

Page 11: 3-D Geometric Transformations

11

3D line equation

● Given A (x0, y0, z0) and B (x1, y1, z1) forming a line.● The equation of this line can be formulated as follows:

ddn

zzyyxx

dcba

n

cba

tzyx

zyx

ˆ,010101

,

.000

Page 12: 3-D Geometric Transformations

12

Order of Rotations

● Order of Rotation Affects Final Position■ X-axis Z-axis

■ Z-axis X-axis

Page 13: 3-D Geometric Transformations

13

General 3D Rotations

● Rotation about an Axis that is Parallel to One of the Coordinate Axes■ Translate the object so that the rotation axis coincides

with the parallel coordinate axis■ Perform the specified rotation about that axis■ Translate the object so that the rotation axis is moved back

to its original position

Page 14: 3-D Geometric Transformations

14

Rotation about an arbitrary axis

Page 15: 3-D Geometric Transformations

15

General 3D Rotations

● Rotation about an Arbitrary Axis Basic Idea

1. Translate (x1, y1, z1) to the origin

2. Rotate (x’2, y’2, z’2) on to the z

axis3. Rotate the object around the z-axis

4. Rotate the axis to the original

orientation

5. Translate the rotation axis to the

original position

(x2,y2,z2)

(x1,y1,z1)

x

z

y

R-1

T-1

R

T

TRRRRRTR xyzyx111

Page 16: 3-D Geometric Transformations

16

General 3D Rotations

● Step 1. Translation

1000100010001

1

1

1

zyx

T

(x2,y2,z2)

(x1,y1,z1)

x

z

y

Page 17: 3-D Geometric Transformations

17

General 3D Rotations

● Step 2. Establish [ TR ]x x

axis

10000//00//00001

10000cossin00sincos00001

dcdbdbdc

x

R

(a,b,c)(0,b,c)

Projected Point

Rotated Point

dc

cb

cdb

cb

b

22

22

cos

sin

x

y

z22 cb

Page 18: 3-D Geometric Transformations

18

General 3D Rotations

● Step 2. Establish [ TR ]x x

axis

22 cb

(a,b,c)(0,b,c)

Projected Point

Rotated Point

dc

cb

cdb

cb

b

22

22

cos

sin

x

y

z

b

c

22 cb

a

222 cba

(a,b,c)(0,b,c)

(0,0,0)(0,0,0)

(0,b,c)

(0,0,c)

Page 19: 3-D Geometric Transformations

19

Arbitrary Axis Rotation

● Step 3. Rotate about y axis by

(a,b,c)

(a,0,d)

l

d

22

222222

cos,sin

cbd

dacballd

la

10000/0/00100/0/

10000cos0sin00100sin0cos

ldla

lald

y

Rx

y

Projected Point

zRotated

Point

a

(0,0,0)

(a,0,d)

d

(0,0,d)

l

Page 20: 3-D Geometric Transformations

20

Arbitrary Axis Rotation

● Step 4. Rotate about z axis by the desired angle

l

1000010000cossin00sincos

zR

y

x

z

Page 21: 3-D Geometric Transformations

21

Arbitrary Axis Rotation

● Step 5. Apply the reverse transformation to place the axis back in its initial position

x

y

l

l

z

10000cos0sin00100sin0cos

10000cossin00sincos00001

1000100010001

1

1

1

111

zyx

yx RRT

TRRRRRTR xyzyx111

Page 22: 3-D Geometric Transformations

22

Find the new coordinates of a unit cube 90º-rotated about an axis defined by its endpoints

A(2,1,0) and B(3,3,1).

A Unit Cube

Example

Page 23: 3-D Geometric Transformations

23

Example

● Step1. Translate point A to the origin

A’(0,0,0)x

z

y

B’(1,2,1)

1000010010102001

T

Page 24: 3-D Geometric Transformations

24

xz

y

l

1000

055

5520

05

52550

0001

xR

6121

55

51cos

552

52

12

2sin

222

22

lB’(1,2,1)

Projected point (0,2,1)

B”(1,0,5)

Example

● Step 2. Rotate axis A’B’ about the x axis by an angle , until it lies on the xz plane.

Page 25: 3-D Geometric Transformations

25

x

z

y

l

1000

06300

66

0010

0660

630

yR

630

65cos

66

61sin

B”(1,0, 5)(0,0,6)

Example

● Step 3. Rotate axis A’B’’ about the y axis by and angle , until it coincides with the z axis.

Page 26: 3-D Geometric Transformations

26

Example

● Step 4. Rotate the cube 90° about the z axis

■ Finally, the concatenated rotation matrix about the arbitrary axis AB becomes,

TRRRRRTR xyzyx 90111

1000010000010010

90zR

Page 27: 3-D Geometric Transformations

27

1000560.0167.0741.0650.0151.1075.0667.0742.0

742.1983.0075.0166.0

1000010010102001

1000

055

5520

05

52550

0001

1000

06300

66

0010

0660

630

1000010000010010

1000

06300

66

0010

0660

630

1000

055

5520

05

52550

0001

1000010010102001

R

Example

Page 28: 3-D Geometric Transformations

28

PRP

11111111076.0091.0560.0726.0817.0650.0301.1467.1483.0409.0151.1225.1184.0258.0484.0558.0

891.2909.1742.1725.2816.2834.1667.1650.2

11111111100110010000111111001100

1000560.0167.0741.0650.0151.1075.0667.0742.0

742.1983.0075.0166.0

P

Example

● Multiplying R(θ) by the point matrix of the original cube

Page 29: 3-D Geometric Transformations

29

Other Transformations

● Reflection Relative to the xy Plane

● Z-axis Shear

xz

y

x

z

y

11000010000100001

1zyx

zyx

'''

110000100010001

1'''

zyx

ba

zyx

Page 30: 3-D Geometric Transformations

30

Coordinate Transformations

● Multiple Coordinate System■ Local (modeling) coordinate system ■ World coordinate scene

Local Coordinate System

Page 31: 3-D Geometric Transformations

31

Coordinate Transformations

● Multiple Coordinate System■ Local (modeling) coordinate system ■ World coordinate scene

Word Coordinate System

Page 32: 3-D Geometric Transformations

32

Coordinate Transformations

● Example – Simulation of Tractor movement■ As tractor moves, tractor coordinate system and front-

wheel coordinate system move in world coordinate system

■ Front wheels rotate in wheel coordinate system

Page 33: 3-D Geometric Transformations

33

Coordinate Transformations

● Transformation of an Object Description from One Coordinate System to Another

● Transformation Matrix■ Bring the two coordinates systems into alignment1. Translation

x

y

z (0,0,0)

y’

z’

x’u'y

u'z

u'x(x0,y0,z0)x

y

z (0,0,0)

u'y

u'z

u'x

000 , , zyx T

Page 34: 3-D Geometric Transformations

34

Coordinate Transformations

2. Rotation & Scaling

x

y

z (0,0,0)

y’

z’

x’u'y

u'z

u'x x

y

z (0,0,0)

u'y

u'zu'x x

y

z (0,0,0)

u'y

u'zu'x

1000000

321

321

321

zzz

yyy

xxx

uuuuuuuuu

R

Page 35: 3-D Geometric Transformations