{VERSION 2 3 "APPLE_PPC_MAC" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 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 "" 0 256 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 {EXCHG {PARA 256 "" 0 "" {TEXT 256 69 "Virtual Reality -- Vect ors Spaces, II: Two, Three, ... N ... Infinity" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 100 "The cell below defines a (5 by 5)-matrix a that represents an image. Then it defines a proce dure " }{TEXT 257 9 "drawimage" }{TEXT -1 145 " that displays the im age represented by an (n by n)-matrix. Finally it uses this procedure to display the image represented by the matrix a. " }{TEXT 258 26 " Evaluate the next cell now" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 444 "with(plots):\n\na := [[0.0, 0.2, 0.4, 0.6, 0.8],\n [0.2, 0.4, 0.6, 0.8, 1.0],\n [0.4, 0.6, 0.8, 1.0, 1.0],\n \+ [0.6, 0.8, 1.0, 1.0, 1.0],\n [0.8, 1.0, 1.0, 1.0, 1.0]]:\n\nd rawimage := proc(a,n)\n densityplot(min(max(0,a[round(n - y*n/(n+1))] [round(x*n/(n+1) + 1)]),1),\n x=0..5,y=0..5,\n \+ style=patch,\n scaling=constrained,\n axe s=none,\n grid=[n,n])\n end:\n\ndrawimage(a,5);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 27 "No tice that the procedure " }{TEXT 259 9 "drawimage" }{TEXT -1 493 " r equires two arguments -- the name of the square matrix representing th e image and the number of rows and columns in the matrix. It is desig ned so that an intensity of zero is black and an intensity of one is t he brightest white that the monitor displays. If a pixel has a negati ve mathematical intensity then it will show up as black and if its mat hematical intensity is bigger than one it will show up as white. Desi gn two images of your own for a square screen, determine the matrices \+ " }{TEXT 260 2 " a" }{TEXT -1 7 " and " }{TEXT 261 1 "b" }{TEXT -1 82 " that represent these images and check your work by displaying th e images using " }{TEXT 263 8 "showimag" }{TEXT -1 1 "e" }{TEXT 264 1 "." }{TEXT -1 63 " Then examine the images represented by matrices \+ of the form " }{TEXT 262 15 "t a + (1 - t) b" }{TEXT -1 1 "." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 169 "After you have experimented a bit look at the next cell. It illustrates how we can make a smooth fade from \+ one image to another using the usual vector space operations." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 434 "b := [[1.0, 0.0, 1.0, 1.0, 1.0],\n [1.0, 0.0, 1.0, 1.0, 1. 0],\n [1.0, 0.0, 1.0, 1.0, 1.0],\n [1.0, 0.0, 1.0, 1.0, 1.0] ,\n [1.0, 0.0, 0.0, 0.0, 1.0]]:\n\nc := [[0.0, 1.0, 1.0, 1.0, 0.0 ],\n [0.0, 1.0, 1.0, 1.0, 0.0],\n [0.0, 0.0, 0.0, 0.0, 0.0], \n [0.0, 1.0, 1.0, 1.0, 0.0],\n [0.0, 1.0, 1.0, 1.0, 0.0]]: \n\ndrawimage(b,5);\ndrawimage(c,5);\n\nfor i from 0 to 20 do \n dr awimage((1 - i/20)*b + (i/20)*c,5) od;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1 0 0" 13 }{VIEWOPTS 1 1 0 1 1 1803 }