conversion view plane

Information about conversion view plane

Published on July 20, 2014

Author: kuldeepkumarmeen

Source: authorstream.com

Content

Mohanlal Sukhadia University,Udaipur: Mohanlal Sukhadia University ,Udaipur SUBMMITED TO:- SUBMMITED BY Mrs. DEEPTI MA’AM KULDEEP KUMAR MCA 4 th SEM SEMINAR ON:- CONVERSION TO VIEW PLANE TO COORDINATES contents : contents 1.projections 2. Projections type (a)perspective and (b)parallel . 3.Transformation and rotation matrix 4. Algorithms Types of projections : Types of projections 2 types of projections perspective and parallel . Key factor is the center of projection . if distance to center of projection is finite : perspective if infinite : parallel Parallel Projection: 4 Parallel Projection Parallel Projection : Coordinate position are transformed to the view plane along parallel lines . Perspective: Perspective Perspective Projection : Object positions are transformed to the view plane along lines that converge to the projection reference (center) point . TMATRIX =TRxRyRz: 6 TMATRIX = TRxRyRz Rotation Matrices: 7 Rotation Matrices Z-axis rotation: For z axis same as 2D rotation Coordinate Axis Rotations: 8 Coordinate Axis Rotations Y-axis rotation: V=(DYN2 + DZN2)1/2 Coordinate Axis Rotations: 9 Coordinate Axis Rotations X-axis rotation: [XUP-VP YUP-VP Z 1 ] = [DXUP DYUP DZUP 1]RxRy   View plane Transformation Algorithm : 10 View plane Transformation Algorithm :Global XR,YR,ZR the view plane reference point DXN,DYN,DZN the view plane normal DXUP,DYUP,DZUP the view_up direction TMATRIX A 4*3 transformation matrix array Cont….: 11 PERSPECTIVE-FLAG the perspective projection flag View-DISTANCE distance between view reference point and view plane Cont…. Cont..: 12 Local V,XUP-VP,YUP-VP,RUP for storage of partial results Constant ROUNDOFF some small number greater than any round-off error BEGIN start with the identity matrix NEW-TRANSFORM-3 ; Cont.. Cont.: 13 translate so that view plane center is new origin TRANSLATE-3(-(XR +DXN+VIEW_DISTANCE),- (YR + DYN * VIEW DISTANCE), -(ZR +DZN * VIEW-DISTANCE)): Rotate so that the view plane normal is z axis V  SQRT(DYN^ 2 + DZN ^ 2); IF V> ROUNDOFF THEN ROTATE –X-3(-DXYN/V,- DZN/V); ROTATE-Y-3(DXN,V); Cont. Cont..: 14 Cont.. Determine the view-up direction in these new coordinates XUP-VP  DXUP * TMATRIX[1,1] + DYUP *TMATRIX[2,1] + DZUP * TMATRIX[3,1]; YUP-VP  DXUP * TMATRIX[1,2] + DYUP *TMATRIX[2,2] + DZUP * TMATRIX[3,2]; Determine rotation needed to make view-up vertical RUP  SQRT(XUP-VP ^ 2 + YUP-VP ^ 2); IF RUP < ROUNDOFF THEN Cont. : 15 Cont. RETURN ERROR ‘SET-VIEW UP ALONG VIEW PLANE NORMAL; ROTATE–Z-3(XUP-VP/RUP,YUP-VP/RUP); IF PERSPECTIVE-FLAG THEN MAKE –PERSPECTIVE-TRANSFORMATION ELSE MAKE-PARALLEL=TRANSFORAMTION; RETURN; END; MAKE PRESPECTIVE TRANSFORAMATION ALGORITHM : 16 MAKE PRESPECTIVE TRANSFORAMATION ALGORITHM Projection to view plane coordinates Global XPCTR,YPCNTR,ZPCNTR the center of projection XC,YC,ZC the center of projection in view plane coordinates BEGIN XC  XPCNTR; YC  YPCNTR; ZC  ZPCNTR; MAKE PRESPECTIVE TRANSFORAMATION ALGORITHM : 17 MAKE PRESPECTIVE TRANSFORAMATION ALGORITHM VIEW-PLANE-TRANSFORM(XC,YC,ZC) IF ZC<0 THEN REUTN ERROR ‘CENTER OF PROJECTION BEHIND VIEW PLANE ; RETURN; END PARALLEL-TRANSFORAMTION: 18 PARALLEL-TRANSFORAMTION Global : TMATRIX a 4 * 3 coordinate transformation matrix array DXP,DYP,DZP the parallel projection vector VXP,VYP,VZP direction of projection in view plane coordinates SXP,SYP the slopes of projection relative to z direction Constant ROUNDOFF some small number greater number greater than CONTT…: 19 CONTT… Any round –off error BEGIN VXP  DXP * TMATRIX[1,1] + DYP * TMATRIX[2,1] + DZP *TMATRIX[3,1]; VYP  DXP * TMATRIX[1,2] + DYP * TMATRIX[2,2] +DZP*TMATRIX[3,2]; VZPDXP*TMATRIX[1,3] + DYP * TMATRIX[2,3]+ DZP * TMATRIX[3,3]; CONTT…: 20 CONTT… IF |VZP| < ROUNDOFF THEN RETURN ERROR ‘PROJECTION PARALLEL VIEW PLANE; SXP  VXP/VZP; SYP VYP/VZP; RETURN ; END; PowerPoint Presentation: 21

Related presentations