{VERSION 3 0 "APPLE_PPC_MAC" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Output" 2 20 "" 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 } {PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 4 4 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple O utput" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Plot" 0 13 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 0 "" 0 "" {TEXT -1 92 "This worksheet demonstrates the e quivalence of a 2D affine transform and the 3D perspective " }}{PARA 0 "" 0 "" {TEXT -1 98 "tranform for relating 3D points on a plane to t heir 2D projected images. The basic idea is to take" }}{PARA 0 "" 0 " " {TEXT -1 95 "a set of 3D points on the z=0 plane which form a four b y four grid and project them. Next, show" }}{PARA 0 "" 0 "" {TEXT -1 93 "that there exists a 2D affine (projective) transformation which ma ps the original coordinates" }}{PARA 0 "" 0 "" {TEXT -1 71 "of the gri d on the 3D plane to the device coordinates after projection." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 102 " \+ J. Ross Bever idge, March 26, 1998" }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 14 "Initi alization" }}{PARA 0 "" 0 "" {TEXT -1 44 " This section customizes the Maple Secssion." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(lin alg):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "readlib(unassign):" }} {PARA 7 "" 1 "" {TEXT -1 32 "Warning, new definition for norm" }} {PARA 7 "" 1 "" {TEXT -1 33 "Warning, new definition for trace" }}}} {SECT 0 {PARA 3 "" 0 "" {TEXT -1 38 " Define the 16 points Forming the Grid" }}{PARA 0 "" 0 "" {TEXT -1 44 "Here the 16 vertices lie on the \+ z=0 plane. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 251 "\nNumPts := 16:\nPtsZplane := []:\nP := vector(NumPts):\nfor i from 0 to (NumPts \+ -1) do\n x := (i mod 4) + 1;\n y := trunc(i/4) + 1;\n P[i+1] := \+ matrix(4,1, [x, y, 0, 1]):\n PtsZplane := [op(PtsZplane),[x,y]]:\nod :\nPts := eval(P);\nunassign('x','y'):\n\n\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$PtsG-%'vectorG6#72-%'matrixG6#7&7#\"\"\"F-7#\"\"!F-- F*6#7&7#\"\"#F-F/F--F*6#7&7#\"\"$F-F/F--F*6#7&7#\"\"%F-F/F--F*6#7&F-F4 F/F--F*6#7&F4F4F/F--F*6#7&F9F4F/F--F*6#7&F>F4F/F--F*6#7&F-F9F/F--F*6#7 &F4F9F/F--F*6#7&F9F9F/F--F*6#7&F>F9F/F--F*6#7&F-F>F/F--F*6#7&F4F>F/F-- F*6#7&F9F>F/F--F*6#7&F>F>F/F-" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 " A plot of the points as they would appear on the Z axis shows us they form a rectilinear grid with unit" }}{PARA 0 "" 0 "" {TEXT -1 15 "length spacing." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 170 "### WARNING : the definition of the type `symbol` has changed'; see help page for \+ details\nplot(PtsZplane,view=[0..5,0..5],style=POINT,axes=BOXED,symbol =circle,color=BLUE);" }}{PARA 13 "" 1 "" {GLPLOT2D 117 109 109 {PLOTDATA 2 "6)-%'CURVESG6#727$$\"\"\"\"\"!F(7$$\"\"#F*F(7$$\"\"$F*F(7 $$\"\"%F*F(7$F(F,7$F,F,7$F/F,7$F2F,7$F(F/7$F,F/7$F/F/7$F2F/7$F(F27$F,F 27$F/F27$F2F2-%'COLOURG6&%$RGBGF*F*$\"*++++\"!\")-%&STYLEG6#%&POINTG-% 'SYMBOLG6#%'CIRCLEG-%+AXESLABELSG6$%!GFR-%*AXESSTYLEG6#%$BOXG-%%VIEWG6 $;F*$\"\"&F*FZ" 1 5 4 1 0 2 6 1 2 2 1.000000 45.000000 45.000000 0 }}} }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 35 "Specify the Camera Model Parame ters" }}{PARA 0 "" 0 "" {TEXT -1 102 "The camera parameters are specif ied in terms of the View Reference Point (VRP), the Lookat Point (L), \+ " }}{PARA 0 "" 0 "" {TEXT -1 116 "the up vector (VUP) and the Perspect ive Reference Point (PRP). The View Plane Normal (VPN) is defined by t he Lookat " }}{PARA 0 "" 0 "" {TEXT -1 119 "Point and the View Referen ce Point. The extends of the bounded imaging plane are specifed as U \+ min/max and V min/max. " }}{PARA 0 "" 0 "" {TEXT -1 117 "These bounds \+ define the window in the View Referece Coordinates. The front and back clipping planes are also defined." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 349 "\nVRP := vector([4.0,4.0,1.0]);\nL := vector([1.0, 1.0, 0.0]);\nVPN := evalm( VRP - L );\nVUP := vector([0.0,0.0,1.0]);\n PRP := vector([0.0,0.0,2.0]);\nfront := 0;\nback := -10;\nUmin := -1. 5:\nUmax := 1.5:\nVmin := -1.5:\nVmax := 1.5: \nwindow = (Umin, Vmin , Umax, Vmax);\nRmin := 0:\nRmax := 441:\nCmin := 0:\nCmax := 441:\nvi ewport = (Cmin, Rmax, Cmax, Rmin);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# >%$VRPG-%'vectorG6#7%$\"#S!\"\"F)$\"#5F+" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"LG-%'vectorG6#7%$\"#5!\"\"F)\"\"!" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$VPNG-%'vectorG6#7%$\"#I!\"\"F)$\"#5F+" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%$VUPG-%'vectorG6#7%\"\"!F)$\"#5!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$PRPG-%'vectorG6#7%\"\"!F)$\"#?!\"\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%&frontG\"\"!" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%backG!#5" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/%'windo wG6&$!#:!\"\"F&$\"#:F(F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/%)viewpor tG6&\"\"!\"$T%F'F&" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 62 "Compute t he World to View Reference Coordinates Transformation" }}{PARA 0 "" 0 "" {TEXT -1 126 "The first step in mapping from the world (scene) coor dinates to the view reference (camera) coordinates is to shift the ori gin" }}{PARA 0 "" 0 "" {TEXT -1 29 " to the View Reference Point." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 138 "T = matrix(4,4,[1,0,0,-vrp[ x],0,1,0,-vrp[y],0,0,1,-vrp[z],0,0,0,1]);\nT := matrix(4,4,[1,0,0,-VRP [1],0,1,0,-VRP[2],0,0,1,-VRP[3],0,0,0,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/%\"TG-%'matrixG6#7&7&\"\"\"\"\"!F+,$&%$vrpG6#%\"xG!\" \"7&F+F*F+,$&F.6#%\"yGF17&F+F+F*,$&F.6#%\"zGF17&F+F+F+F*" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%\"TG-%'matrixG6#7&7&\"\"\"\"\"!F+$!#S!\"\"7&F+ F*F+F,7&F+F+F*$!#5F.7&F+F+F+F*" }}}{PARA 3 "" 0 "" {TEXT -1 56 "Comput e the Rotation Matrix and Compose with Translation" }}{PARA 0 "" 0 "" {TEXT -1 117 "The next step is to rotation the coordinate system so th at the Z axis becomes the n axis (defined by the direction of" }} {PARA 0 "" 0 "" {TEXT -1 111 " the VPN) and the v axis points upwards \+ as defined by VUP. Recall that to accomplish this we define the three " }}{PARA 0 "" 0 "" {TEXT -1 43 "orthogonal vectors n, u, and v as fo llows. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 199 "mag := sqrt( VPN [1]^2 + VPN[2]^2 + VPN[3]^2) ;\nn := scalarmul( VPN, 1/mag);\nUt := cr ossprod( VUP, VPN );\nmag := sqrt( Ut[1]^2 + Ut[2]^2 + Ut[3]^2) ;\nu : = scalarmul( Ut, 1/mag );\nv := crossprod(n, u);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$magG$\"+W*)*)eV!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"nG-%'vectorG6#7%$\"+9?Z#)o!#5F)$\"+Qt:%H#F+" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%#UtG-%'vectorG6#7%$!$+$!\"#$\"$+$F+\"\"!" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$magG$\"+(oSEC%!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uG-%'vectorG6#7%$!+7y1rq!#5$\"+7y1rqF+\"\"!" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vG-%'vectorG6#7%$!+6U@A;!#5F)$\"+m _GL(*F+" }}}{PARA 0 "" 0 "" {TEXT -1 56 "The rotation is now formed fr om these new basis vectors." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 156 "R = matrix(4,4,[u[x],u[y],u[z],0,v[x],v[y],v[z],0,n[x],n[y],n[z], 0,0,0,0,1]);\nR := matrix(4,4,[u[1],u[2],u[3],0,v[1],v[2],v[3],0,n[1], n[2],n[3],0,0,0,0,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/%\"RG-%'mat rixG6#7&7&&%\"uG6#%\"xG&F+6#%\"yG&F+6#%\"zG\"\"!7&&%\"vGF,&F7F/&F7F2F4 7&&%\"nGF,&F%\"RG-%'matrixG6#7&7&$!+7y1rq!#5$\"+7y1rqF,\"\"!F/7&$!+6U@A;F,F1$\" +m_GL(*F,F/7&$\"+9?Z#)oF,F6$\"+Qt:%H#F,F/7&F/F/F/\"\"\"" }}}{PARA 0 " " 0 "" {TEXT 256 83 "The world to VRC transformation is the compositio n of the translation and rotation." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Mo := evalm( R &* T);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#MoG-%'matrixG6#7&7&$!+7y1rq!#5$\"+7y1rqF,\"\"!F/7&$!+6U@A;F,F 1$\"+m_GL(*F,$\"+C%GWC$F,7&$\"+9?Z#)oF,F8$\"+Qt:%H#F,$!+YLRNd!\"*7&F/F /F/\"\"\"" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 55 "Map to the Canonic al Perspective Projection View Volume" }}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 51 "Translate Origin to the Perspective Reference Point" }} {PARA 0 "" 0 "" {TEXT -1 80 "The origin of the canonical view volume l ies at the Perspective Reference Point." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 74 "Tp := matrix(4,4,[1,0,0,-PRP[1], 0,1,0,-PRP[2], 0,0,0 1,-PRP[3], 0,0,0,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#TpG-%'matr ixG6#7&7&\"\"\"\"\"!F+F+7&F+F*F+F+7&F+F+F*$!#?!\"\"7&F+F+F+F*" }}}} {PARA 3 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 42 "C ompute the Shear to align DOP with Z axis" }}{PARA 0 "" 0 "" {TEXT -1 88 "The Direction of Projection may not be parallel to the Z (N) axis. The following shear " }}{PARA 0 "" 0 "" {TEXT -1 38 "will insure tha t the two are parallel." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 192 " CW := vector([(Umax + Umin)/2, (Vmax + Vmin)/2, 0]);\nDOP := evalm( C W - PRP );\nshx := - (DOP[1]/DOP[3]):\nshy := - (DOP[2]/DOP[3]):\nSH \+ := matrix(4,4,[1,0,shx,0, 0,1,shy,0, 0,0,1,0, 0,0,0,1]);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%#CWG-%'vectorG6#7%\"\"!F)F)" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%$DOPG-%'vectorG6#7%\"\"!F)$!#?!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#SHG-%'matrixG6#7&7&\"\"\"\"\"!F+F+7&F+F*F+F+7&F +F+F*F+7&F+F+F+F*" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 30 "Scale to C anonical View Volume" }}{PARA 0 "" 0 "" {TEXT -1 83 "The Canonical Vie w Volume runs from 0 to -1 on the Z axis, and between -1 and 1 on " }} {PARA 0 "" 0 "" {TEXT -1 78 "the X and Y (U and V) axes. The followin g saling will accomplish this change." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 263 "VRPP := evalm( SH &* Tp &* matrix(4,1,[0.0,0.0,0.0,1 ]));\nd := convert(VRPP[3,1],float);\nSx := (2 * d) / ((Umax - Umin) * (d + back)):\nSy := (2 * d) / ((Vmax - Vmin) * (d + back)):\nSz := -1 / (d + back):\nSper := matrix(4,4,[Sx,0,0,0, 0,Sy,0,0, 0,0,Sz,0, 0,0, 0,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%VRPPG-%'matrixG6#7&7#\"\" !F)7#$!#?!\"\"7#\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"dG$!#?! \"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%SperG-%'matrixG6#7&7&$\"+66 666!#5\"\"!F-F-7&F-F*F-F-7&F-F-$\"+LLLL$)!#6F-7&F-F-F-\"\"\"" }}}}} {SECT 0 {PARA 3 "" 0 "" {TEXT -1 62 "Perspective Projection by Mapping Persp Veiw Vol to Para View." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 216 "\nunassign('Zmin');\nMp := \+ matrix(4,4,[1,0,0,0, 0,1,0,0, 0,0,1/(1+Zmin),-Zmin/(1+Zmin), 0,0,-1,0] );\nZmin := - ( (d + front) / (d + back) );\nMp := matrix(4,4,[1,0,0,0 , 0,1,0,0, 0,0,1/(1+Zmin),-Zmin/(1+Zmin), 0,0,-1,0]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#MpG-%'matr ixG6#7&7&\"\"\"\"\"!F+F+7&F+F*F+F+7&F+F+*&\"\"\"F/,&F*F*%%ZminGF*!\"\" ,$*&F1F/F0F2!\"\"7&F+F+F5F+" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%Zmin G$!+nmmm;!#5" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#MpG-%'matrixG6#7&7& \"\"\"\"\"!F+F+7&F+F*F+F+7&F+F+$\"+++++7!\"*$\"+++++?!#57&F+F+!\"\"F+ " }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 20 " Put it all Together" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "Nper := evalm( Mp &* Sper &* SH &* Tp &* Mo);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%NperG-%'matrixG6#7&7&$!+8?ucy!#6$\"+8?ucyF,\"\"!F/7& $!+M-Y-=F,F1$\"+ThZ\"3\"!#5$\"+r/#\\g$F,7&$\"+9?Z#)oF,F9$\"+Qt:%H#F,$! +YLRNdF57&$!+XLRNdF,F@$!+#y(z6>F,$\"+A6;YkF5" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 52 "Canoni cal View Volume to Device Coordinates Tranform" }}{PARA 0 "" 0 "" {TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 344 "\nwidth : = Rmax - Rmin;\nheight := Cmax - Cmin;\nMd0 := matrix(4,4, [1,0,0,0, 0 ,-1,0,0, 0,0,1,0, 0,0,0,1]);\nMd1 := matrix(4,4, [1,0,0,1, 0,1,0,1, 0, 0,1,0, 0,0,0,1]);\nMd2 := matrix(4,4, [width/2,0,0,0, 0,height/2,0,0, \+ 0,0,1,0, 0,0,0,1]);\nMd3 := matrix(4,4, [1,0,0,-Rmin, 0,1,0,Cmin, 0,0, 1,0, 0,0,0,1]);\nMd := evalm( Md3 &* Md2 &* Md1 &* Md0 );\n\n\n" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%&widthG\"$T%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'heightG\"$T%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$M d0G-%'matrixG6#7&7&\"\"\"\"\"!F+F+7&F+!\"\"F+F+7&F+F+F*F+7&F+F+F+F*" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$Md1G-%'matrixG6#7&7&\"\"\"\"\"!F+F *7&F+F*F+F*7&F+F+F*F+7&F+F+F+F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$ Md2G-%'matrixG6#7&7&#\"$T%\"\"#\"\"!F-F-7&F-F*F-F-7&F-F-\"\"\"F-7&F-F- F-F0" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$Md3G-%'matrixG6#7&7&\"\"\" \"\"!F+F+7&F+F*F+F+7&F+F+F*F+7&F+F+F+F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#MdG-%'matrixG6#7&7&#\"$T%\"\"#\"\"!F-F*7&F-#!$T%F,F-F*7&F-F- \"\"\"F-7&F-F-F-F2" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 27 "The Compl ete Transformation" }}{PARA 0 "" 0 "" {TEXT -1 72 "Mtot is the the com plete transformation from World to Device coordinates" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "Mtot := evalm( Md &* Nper);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%%MtotG-%'matrixG6#7&7&$!+Ze1(*H!\")$\"*\"QdxYF ,$!+4T^:U!\"*$\"+F&y8U\"!\"(7&$!+9v6s')F1F6$!+-j?1GF,$\"+J+*=M\"F47&$ \"+9?Z#)o!#6F=$\"+Qt:%H#F?$!+YLRNd!#57&$!+XLRNdF?FF$!+#y(z6>F?$\"+A6;Y kFD" }}}{PARA 0 "" 0 "" {TEXT -1 104 " Show the 3D points before and after the projection operation. Notice that the Z value has been scal ed" }}{PARA 0 "" 0 "" {TEXT -1 39 "to lie in the interger range 0 to - 256." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 267 "PPts := vector(NumP ts):\nfor i from 1 to NumPts do\n Pt := evalm( Mtot &* Pts[i] ):\n \+ Pt[1,1] := round(Pt[1,1] / Pt[4,1] );\n Pt[2,1] := round(Pt[2,1] / \+ Pt[4,1]);\n Pt[3,1] := (Pt[3,1] / Pt[4,1]);\n Pt[4,1] := 1;\n PP ts[i] := eval(Pt);\nod:\neval(Pts);\neval(PPts);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'vectorG6#72-%'matrixG6#7&7#\"\"\"F+7#\"\"!F+-F(6#7&7 #\"\"#F+F-F+-F(6#7&7#\"\"$F+F-F+-F(6#7&7#\"\"%F+F-F+-F(6#7&F+F2F-F+-F( 6#7&F2F2F-F+-F(6#7&F7F2F-F+-F(6#7&F " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 37 "Plo t the Points in device coordinates" }}{PARA 0 "" 0 "" {TEXT -1 113 " \+ Create a list of the 2D points suitable for plotting. Also create a \+ set of column vectors for the 2D points. " }}{PARA 0 "" 0 "" {TEXT -1 39 " Finally, plot the resulting points. " }}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 190 "DevPts := []:\nPts2D := vector(NumPts):\nfor i fro m 1 to NumPts do\n temp := PPts[i]:\n DevPts := [op(DevPts),[temp[ 1,1],temp[2,1]]]:\n Pts2D[i] := matrix(3,1, [temp[1,1],temp[2,1],1]) :\nod:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 160 "### WARNING: the definit ion of the type `symbol` has changed'; see help page for details\nplot (DevPts,view=[0..400,0..400],style=POINT,symbol=circle,color=BLUE);" } }{PARA 13 "" 1 "" {GLPLOT2D 289 228 228 {PLOTDATA 2 "6(-%'CURVESG6#727 $$\"$?#\"\"!$\"$@#F*7$$\"$%=F*$\"$H#F*7$$\"$P\"F*$\"$S#F*7$$\"#vF*$\"$ a#F*7$$\"$d#F*F07$F(F57$$\"$s\"F*F:7$$\"$0\"F*$\"$t#F*7$$\"$/$F*F57$$ \"$p#F*F:7$F(FF7$$\"$\\\"F*$\"$-$F*7$$\"$m$F*F:7$$\"$O$F*FF7$$\"$#HF*F R7$F($\"$\\$F*-%'COLOURG6&%$RGBGF*F*$\"*++++\"!\")-%&STYLEG6#%&POINTG- %'SYMBOLG6#%'CIRCLEG-%+AXESLABELSG6$%!GF\\p-%%VIEWG6$;F*$\"$+%F*F`p" 1 5 4 1 0 2 6 1 4 2 1.000000 45.000000 45.000000 0 }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 30 "C an we invert the 3D mapping ?" }}{PARA 0 "" 0 "" {TEXT -1 94 " The qu estion arises, can the complete world to device coordinate transformat ion be inverted." }}{PARA 0 "" 0 "" {TEXT -1 11 "If so, how?" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "MtotInv := inverse(Mtot);" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(MtotInvG-%'matrixG6#7&7&$!+C,:')G! #6$\"+\"\\#G@m!#7$\"++sC)o#!\")$\"+AoR!*GF27&$\"+C,:')GF,$\"+\"[#G@mF/ $\"+.sC)o#F2$\"+>Yg<;F27&$\"+l]$e***!#@$!+(\\pF(RF,$\"+Ft:%H(!\"*$\"+t c*fZ\"F27&\"\"!$!+l]$e***!#A$\"+********\\FF$\"+)*******fFF" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 266 "backPts := vector(NumPts): \nfor i from 1 to NumPts do\n Pt := evalm(MtotInv &* PPts[i]);\n Pt[ 1,1] := round(Pt[1,1] / Pt[4,1] );\n Pt[2,1] := round(Pt[2,1] / Pt[4, 1]);\n Pt[3,1] := round(Pt[3,1] / Pt[4,1]);\n Pt[4,1] := 1;\n backP ts[i] := eval(Pt);\nod:\neval(backPts);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'vectorG6#72-%'matrixG6#7&7#\"\"\"F+7#\"\"!F+-F(6#7&7#\"\"#F+F -F+-F(6#7&7#\"\"$F+F-F+-F(6#7&7#\"\"%F+F-F+-F(6#7&F+F2F-F+-F(6#7&F2F2F -F+-F(6#7&F7F2F-F+-F(6#7&F " 0 "" {MPLTEXT 1 0 0 "" }}}}} {MARK "17 4 1" 0 }{VIEWOPTS 1 1 0 1 1 1803 }