Viewing Transformations CS5600 Computer Graphics by Rich Riesenfeld 5 March 2002 Lecture Set 11 CS5600
Homogeneous Coordinates An infinite number of points correspond to (x,y,1). They constitute the whole line (tx,ty,t). (tx,ty,t) w = 1 (x,y,1) CS5600
Illustration: Old Style, Simple Transformation Sequence for 3D Viewing CS5600 CS5600
Simple Viewing Transformation Example Points A B C D E F G H X -1 1 Y Z CS5600 CS5600
Simple Cube Viewed from (6,8,7.5) H=(-1,-1,1) E=(-1,1,1) F=(1,1,1) G=(1,-1,1) D=(-1,-1,-1) A=(-1,1,-1) C=(1,-1,-1) B=(1,1,-1) CS5600
Topology of Cube A B C D E F G H 1 B C E H D F G A CS5600 CS5600
Topology of Cube A: B D E B: A C F C: G D: H E: F: G: H: H E G F D A C CS5600 CS5600
Simple Example Give a Cube with corners View from Eye Position (6,8,7.5) Look at Origin (0,0,0) “Up” is in z-direction CS5600 CS5600
Translate Origin by (6,8,0) CS5600 CS5600
Simple Viewing Transformation Example CS5600 CS5600
Build LH Coord with (6,8,0) CS5600 CS5600
Build LH Coord with CS5600 CS5600
Rotate about y with 6 10 (6,8,0) 8 CS5600 CS5600
Simple Viewing Transformation Example CS5600 CS5600
Rotate about x-axis with 7.5 10 CS5600 CS5600
Look at the (3-4-5) Right Triangle 10 (4) 7.5 (3) (5) 12.5 CS5600 CS5600
Simple Viewing Transformation Examle CS5600 CS5600
View on 10x10 screen, 20 away 20 10 10 CS5600 CS5600
Map to canonical frustum 20 20 CS5600 CS5600
Scale x,y by 2 for normalization Will view a 20”x20” screen from 20” away. Scale to standard viewing frustum. CS5600 CS5600
Simple Viewing Transformation Example CS5600 CS5600
Clipping not needed, so project CS5600 CS5600
Transformation of Cube CS5600 CS5600
Cube Transformed for Viewing Pts A B C D E F G H X 2.8 -0.4 -2.8 0.4 Y -1.84 -3.28 -1.36 .08 1.36 -.08 1.84 3.28 Z 12.94 11.98 13.26 14.22 11.74 10.78 12.06 13.02 CS5600 CS5600
Transformed Cube G=(-2.8,1.84) E=(2.8,1.36) F=(-0.4,-.08) D=(0.4,.08) Pt X Y A 2.8 -1.84 B -0.4 -3.28 C -2.8 -1.36 D 0.4 08 E 1.36 F -.08 G 1.84 H 3.28 H=(0.4,3.28) G=(-2.8,1.84) E=(2.8,1.36) F=(-0.4,-.08) D=(0.4,.08) A: B D E B: A C F C: G D: H E: F: G: H: C=(-2.8,-1.36) A=(2.8,-1.84) B=(-0.4,-3.28) 25 CS5600
Recall mapping [a,b] [-1,1] Translate center of interval to origin Normalize interval to [-1,1] CS5600 CS5600
Recall mapping [a,b] [-1,1] Substitute x =a: x CS5600 CS5600
Recall mapping [a,b] [-1,1] Substitute x =b: x CS5600 CS5600
Map to the (1K x 1K) screen Assume screen origin (0,0) at lower left. This translates old (0,0) to center of screen (511,511). CS5600 CS5600
Map to the (1K x 1K) screen Proper scale factor for mapping: CS5600 CS5600
Combine Screen Transformation CS5600 CS5600
For General Screen: …… CS5600 CS5600
Transformation to Std Clipping Frustum CS5600 CS5600
Transforming to Std Frustum CS5600 CS5600
Transforming to Std Frustum CS5600 CS5600
Transforming to Std Frustum The right scale matrix to map to canonical form CS5600 CS5600
Transforming to Std Frustum CS5600 CS5600
Determining Rotation Matrix CS5600
Frame rotation, CS5600 CS5600
Inverse problem easy, CS5600 CS5600
In matrix representation of , Columns are simply images of CS5600 CS5600
Rotation matrix M columns given by frame’s pre-image Column i of is CS5600 CS5600
Inverse of rotation matrix M Recall, for rotation matrix R, So, CS5600 CS5600
Rotation matrix M Row i is simply Simply write M down! Thus, CS5600
Frame Rotation: CS5600 CS5600
46 CS5600
47 CS5600
48 CS5600
49 CS5600
50 CS5600
51 CS5600
52 CS5600
The End of Viewing Transformations Lecture Set 11 53 CS5600