Computer Graphic - Transformations in 3d
-
Upload
2013901097 -
Category
Education
-
view
7 -
download
2
Transcript of Computer Graphic - Transformations in 3d
COMPUTER GRAPHICSCH04 – TRANSFORMATIONS IN 3D
3D GRAPH
Right handed space consistent with math. Left handed space suitable to screens. To transform from right to left negate the z values.
TRANSLATION
SCALING
SHEARING
REFLECTION
ROTATION
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE There are five steps for reflection about an arbitrary point in space:
1. Translate to the origin by –(x0,y0,z0).2. Rotate (x’,y’,z’) about x-axis.3. Rotate (x’,y’,z’) about y-axis.4. Rotate about z-axis.5. Inverse step 2 By changing the sin sign.6. Inverse step 3 By changing the sin sign.7. Inverse step 1 By changing the tx, ty and tz sign.
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE EX: Find the new coordinate of a unit cube 90 degree rotated about an axis defined by its end points A(2,1,0) and B(3,3,1).
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 1: Translate to origin
a= 3-2= 1 b= 3-1= 2 c= 1-0= 1
1 0 0 -20 1 0 -
10 0 1
00 0 0
1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 2: Rotation about x-axis D= = = Sin= b/d= 2/ Cos= c/d= 1/
1 0 0 0
0 1/ -2/ 10 2/ 1/ 1
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 3: Rotation about y-axis L= = Sin= a/L= 1/ Cos= d/L= /
/0 -1/0 0 1 0
0/0 /0
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 4: Rotation about z-axis by 90 degree0 -1 0
01 0 0
00 0 1
00 0 0
1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 5: Inverse Rotation about x-axis
1 0 0 0
0 1/ 2/ 10 -2/ 1/ 1
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 6: Inverse Rotation about y-axis
/0 1/0 0 1 0
0/0 / 0
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 7: Inverse of Translation
Then we multiply all the matrices with each other.
1 0 0 20 1 0
10 0 1
00 0 0
1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE EX: Find the rotation for the point (1,2,1) by 90 degree
(1,2,3)
(4,6,7)
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 1: Translate to origin
A= 4-1= 3 B= 6-2= 4 C= 7-3= 4
1 0 0 -10 1 0 -
20 0 1 -
30 0 0
1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 2: Rotation about x-axis D= = = Sin= b/d= 4/ Cos= c/d= 4/
1 0 0 0
0 4/ -4/ 10 4/ 4/ 1
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 3: Rotation about y-axis L= = Sin= a/L= 3/ Cos= d/L=/
/0 -3/0 0 1 0
0 /0 /0
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 4: Rotation about z-axis by 90 degree0 -1 0
01 0 0
00 0 1
00 0 0
1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 5: Inverse step 2
1 0 0 0
0 4/ 4/ 10 -4/ 4/ 1
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 6: Inverse step 3
/0 /0 0 1 0
0 -/0 /0
0 0 0 1
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE Step 1: Inverse step 1
Then we multiply all the matrices with each other and with the point (1,2,1).
1 0 0 10 1 0
20 0 1
30 0 0
1