Transformations in 3D Right-handed coordinate system z-axis points - - PowerPoint PPT Presentation

transformations in 3d
SMART_READER_LITE
LIVE PREVIEW

Transformations in 3D Right-handed coordinate system z-axis points - - PowerPoint PPT Presentation

Transformations in 3D Right-handed coordinate system z-axis points toward viewer y x z Translation in 3D What are the coordinates of P after translating by d=(dx,dy,dz) x' = ? y' = ? P'(x',y', z') z' = ? P(x,y,z) Translation in 3D


slide-1
SLIDE 1

Transformations in 3D

z x y Right-handed coordinate system – z-axis points toward viewer

slide-2
SLIDE 2

Translation in 3D

What are the coordinates of P after translating by d=(dx,dy,dz)

P(x,y,z) P'(x',y', z')

x' = ? y' = ? z' = ?

slide-3
SLIDE 3

Translation in 3D

What are the coordinates of P after translating by d=(dx,dy,dz)

P(x,y,z) P'(x',y', z')

x' = x + dx = 1*x + 0*y + 0*z + 1*dx y' = y + dy = 0*x + 1*y + 0*z + 1*dy z' = z + dz = 0*x + 0*y + 1*z + 1*dz in matrix form

x' y' z' 1 x y z 1

= *

1 dx 1 dy 1 dz 1

slide-4
SLIDE 4

Scaling in 3D

What are the coordinates of P after scaling by sx,sy,sz

P(x,y,z) P'(x',y',z')

x' = ? y' = ? z' = ?

slide-5
SLIDE 5

Scaling in 3D

What are the coordinates of P after scaling by sx,sy,sz

P(x,y,z) P'(x',y',z')

x' = sx * dx = sx*x + 0*y + 0*z y' = sy * dy = 0*x + sy*y + 0*z z' = sz * dz = 0*x + 0*y + sz*z in matrix form

x' y' z' 1 x y z 1

= *

sx sy sz 1

slide-6
SLIDE 6

Rotation in 3D around Z-axis

Rotating in a plane parallel to the XY-plane Same as rotating in 2D keep the Z-coordinate the same

P(x,y,z) a r r P'(x',y',z') P(x,y,z) a r r P'(x',y',z')

slide-7
SLIDE 7

Rotation in 3D around Z-axis

Rotating in a plane parallel to the XY-plane Same as rotating in 2D keep the Z-coordinate the same Same matrix with extra row, column

cosα

  • sinα

sinα cosα 1 1

x' y' z' 1 x y z 1

= *

P(x,y,z) a r r P'(x',y',z') P(x,y,z) a r r P'(x',y',z')

slide-8
SLIDE 8

Rotation in 3D around Y-axis

P'(x',y',z') P(x,y,z)

Rotating in a plane parallel to the XY-plane Same as rotating in 2D keep the Y-coordinate the same

a P'(x',y',z') P(x,y,z) a

slide-9
SLIDE 9

Rotation in 3D around Y-axis

cosα sinα 1

  • sinα

cosα 1

P'(x',y',z') P(x,y,z)

Rotating in a plane parallel to the XY-plane Same as rotating in 2D keep the Y-coordinate the same

x' y' z' 1 x y z 1

= *

a P'(x',y',z') P(x,y,z) a

slide-10
SLIDE 10

Rotation in 3D around X-axis

P(x,y,z) P'(x',y',z') α P(x,y,z) P'(x',y',z') α

Rotating in a plane parallel to the YZ-plane Same as rotating in 2D keep the X-coordinate the same

slide-11
SLIDE 11

Rotation in 3D around X-axis

1 cosα

  • sinα

sinα cosα 1

P(x,y,z) P'(x',y',z') α P(x,y,z) P'(x',y',z') α

Rotating in a plane parallel to the YZ-plane Same as rotating in 2D keep the X-coordinate the same

x' y' z' 1 x y z 1

= *

slide-12
SLIDE 12

Rotation around arbitrary axis

P(x,y,z) α P'(x',y',z') A(ax,ay,az)

can reduce to rotation around Z-axis by realignment of coordinate system

slide-13
SLIDE 13

Rotation around arbitrary axis

P(x,y,z) A(ax,ay,az)

slide-14
SLIDE 14

Rotation around arbitrary axis

P(x,y,z) A(ax,ay,az) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”)

compute A',A” s.t. A,A',A” perpend.

slide-15
SLIDE 15

Rotation around arbitrary axis

P(x,y,z) A(ax,ay,az) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”)

compute A',A” s.t. A,A',A” perpend. align A',A”,A with main axes X,Y,Z

slide-16
SLIDE 16

Rotation around arbitrary axis

P(x,y,z) A(ax,ay,az) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”)

compute A',A” s.t. A,A',A” perpend. align A',A”,A with main axes X,Y,Z

ax' ay' az' ax” ay” az” ax ay az 1

M

slide-17
SLIDE 17

Rotation around arbitrary axis

P(x,y,z) A(ax,ay,az) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) P(x,y,z) P'(x',y',z') A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) α

compute A',A” s.t. A,A',A” perpend. align A',A”,A with main axes X,Y,Z rotate around z

ax' ay' az' ax” ay” az” ax ay az 1

M

ca

  • sa

sa ca 1 1

R

slide-18
SLIDE 18

Rotation around arbitrary axis

P(x,y,z) α P'(x',y',z') A(ax,ay,az) P(x,y,z) A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) P(x,y,z) P'(x',y',z') A(ax,ay,az) A'(ax',ay',az') A”(ax”,ay”,az”) α

compute A',A” s.t. A,A',A” perpend. align A',A”,A with main axes X,Y,Z r e s t

  • r

e a l i g n m e n t rotate around z

ax' ay' az' ax” ay” az” ax ay az 1

M

ax' ax” ax ay' ay” ay az' az” az 1

M'

ca

  • sa

sa ca 1 1

R

slide-19
SLIDE 19

Rotation around arbitrary axis

P(x,y,z) α P'(x',y',z') A(ax,ay,az)

can reduce to rotation around Z-axis by realignment of coordinate system R = M' * Rz * M multiply top of stack by R

slide-20
SLIDE 20

Rendering Pipeline

Mmodel Mview*Mproj World space View space Screen space

P’ = Mproj Mview Mmodel * P

http://www.songho.ca/opengl/gl_transform.html

slide-21
SLIDE 21

The Camera Model (2D)

v u e camera parameters: e – eye point coordinates v – the directions of the view u – up vector e – what is the position (ex,ey)

  • f the camera in the world

v – what are the coordinates (vx,vy) of the viewing direction in the world u – a vector perpendicular to v v u e The camera parameters and the coordinates of the model are specifjed in world space

slide-22
SLIDE 22

The Camera Model (2D)

v u e To render the model need to: represent it from world space to camera view space coordinates – Mview project it on the camera film – Mproj v u e x y x' y'

slide-23
SLIDE 23

The Camera Model (2D)

World to View space transformation (Mview) – align camera axes with the world axes u v e

slide-24
SLIDE 24

The Camera Model (2D)

T R

World to View space transformation (Mview) – align camera axes with the world axes u v e

slide-25
SLIDE 25

The Camera Model (2D)

T R

1

  • ex

1

  • ey

1

World to View space transformation (Mview) – align camera axes with the world axes u v e

slide-26
SLIDE 26

The Camera Model (2D)

T R

1

  • ex

1

  • ey

1 vx vy ux uy 1

World to View space transformation (Mview) – align camera axes with the world axes u v e

slide-27
SLIDE 27

The Camera Model (2D)

T R

1

  • ex

1

  • ey

1 vx vy ux uy 1

Mview = R*T

World to View space transformation (Mview) – align camera axes with the world axes u v e