Docsity

3D Transformation notes, Lecture notes of Computer Graphics

Partial preview of the text

Download 3D Transformation notes and more Lecture notes Computer Graphics in PDF only on Docsity!

3D TRANSFORMATION

By:

Arvind Kumar

Assistant Professor

(CSE Department)

Contents

3D

Translation Rotation Scaling Reflection Shearing

3D Scaling

3D

Uniform Scaling

x '= xsx , y '= ysy , z '= zsz



 

 

 

 

 

 

 



 

 

 

0 0 0 1 1

0 0 0

0 0 0

0 0 0

1

'

'

' z

y

x s

s

s z

y

x z

y

x

z^ x

y

3D Composite Scaling

3D

Scaling with a Fixed Point



 

 

 

 

 

 

 

 −− − 

 

 

 

 

 

 

 

 = 

 

 

   − − − = 00 00 01 1 1

10 10 00 00 00 0 10

0 0 00 00 00 00 01 1

01 10 00 1 '

T ( xf , yf , zf ) S ( sx , sy , sz ) T ( xf , yf , zf ) zyx '' zyxfff sx sy sz zyx fff x zy

z

y y y (^) y

Original position Inverse Translate

x (^) z x (^) z x (^) z x Translate Scaling

3D Rotation Coordinate axis

3D

About X-Axis 3D

0 sin cos 0

0 cos sin 0

z

y

x

z

y

x

z

y

x

3D Rotation Coordinate axis

3D

About Y-Axis 3D

z

y

x 

 

 

 

 

 

 

 

  = −

 

 

 

0 0 0 1 1

sin 0 cos 0

0 1 0 0

cos 0 sin 0

1

'

'

' z

y

x z

y

x  

 

3D Rotation about an parallel axis

3D

Steps to be follows:

  • Translate coincides with the the object parallel so (^) coordinatethat the rotation axis axis
  • – RotationTranslate about the object that axis so .that the rotation axis is moved back to its original position x

Rotation about an arbitrary Axis

3D

1. Translate^ Steps to be Follows (x 1 , y 1 , z 1 ) to the

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

  1. axisRotate the object around the z-
  2. axisRotate the axis to the original
  3. orientationTranslate the rotation axis to** the original position

R-^1 T-^1

R

T

R ( ) = T −^1 R^ − x^1 ( ) R − y^1 ( ) R (^) z ( ) R (^) y ( ) R (^) x (  ) T

R

(x 2 ,y 2 ,z 2 ) (x 1 ,y 1 ,z 1 ) x z

y

Rotation about an arbitrary Axis

3D

❖ Step 2. Rotatation about x-axis

( )  

 

 

= − 

 

 

 

= − 00 0 / 0 / 10

01 0 /^0 / 00 00 sin 0 cos 0 10

R x ^01 cos^0  sin^0 ^00 bc dd cb dd

(0,b,c)

Projected Point   d
b c c dc
b b c b

2 2

2 2

cos
y sin

z

(a,b,c)x Rotated Point

Rotation about an arbitrary Axis

3D

  • Step 3. Rotate about y axis 2 22 22 2 2 2 sin , cos ld ab b c c a d

al dl == + + + = +

( )  

 

  =^ − 

 

 

  =^ − 0 / 00 0 / 10

0 / 10 0 / 00 sin 0 00 cos 0 10 R y  cos^0 ^10 sin^0 ^00 da ll da ll

(a,b,c)d l x

y Projected Point z Rotated Point ^ (a,0,d)

Rotation about an arbitrary Axis

3D

❖ place the axis back in its initial positionStep 5. Apply the reverse transformation to ( ) ( )



 

 

 

 −



 

 

 

  −

 

 

 

 −− − − − − =

sin 0 00 cos 0 10

cos 0 10 sin 0 00 00 sin 0 cos 0 10

01 cos^0 sin^000 00 00 01 1

1 1 1 01 10 00 111

  zy  

x T R x R y

R ( ) = T −^1 R^ − x^1 ( ) R − y^1 ( ) R (^) z ( ) R (^) y ( ) R (^) x (  ) T

y l l z

x

Numerical

3D

Q1. Find an axis defined by its endpoints A(2,1,0) and B(3,3,1). the new coordinates of a unit cube 90º-rotated about

Solution:

3D

Step2. angle  Rotate axis, until it lies on the A’B’ about the x axis by and xz plane

( ) 

 

 

 

 −

0 0 05 10 0 255 55 0 R x ^015052050

1 2 1 6

cos^1555

sin 22 1 25 255 2 2 2

2 2 = + + =

= =

= + = =

l x z

y

l

B’(1,2,1)

Projected point (0,2,1)

B”(1,0,5 )

Solution:

3D

Step3. coincides with the z axis. Rotate axis A’B’’ about the y axis, until it

( ) 



 





 

 (^) −

0 0 06 10 606 10 030 0

630 0 66 0 R y

cos 65 630

sin^1666 = =

= = 

x z

y

^ l A’(0,0,6 ) B”(1,0,5)