{VERSION 2 3 "APPLE_68K_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 } {CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 276 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 277 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 278 "" 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 1 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 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 -1 27 "Virtual Reality -- Flatl and" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 150 "T he following cells define several Maple procedures for displaying and \+ manipulating images. Each image is represented by a list of points of the form" }}{PARA 257 "" 0 "" {TEXT -1 2 "\n\n" }{TEXT 256 34 "[[x1, \+ y1], [x2, y2], ... [xn, yn]]" }{TEXT -1 2 "\n\n" }}{PARA 0 "" 0 "" {TEXT -1 89 "and is drawn by connecting the points by lines.\n\nYou wi ll use the following procedures:\n\n" }{TEXT 257 18 "plotcurve(list, n )" }{TEXT -1 118 " -- This procedure displays one image represented by a list of points as described above. The x- and y-axes run from " } {TEXT 258 2 "-n" }{TEXT -1 4 " to " }{TEXT 259 1 "n" }{TEXT -1 3 ".\n \n" }{TEXT 260 27 "plotcurves(list1, list2, n)" }{TEXT -1 104 " -- Thi s procedure displays two images represented by two lists of points. t he x- and y-axes run from " }{TEXT 261 2 "-n" }{TEXT -1 5 " to " } {TEXT 262 1 "n" }{TEXT -1 84 ". The first image is displayed in black and the second image is displayed in red.\n\n" }{TEXT 263 12 "mirror( list)" }{TEXT -1 85 " -- This procedure computes the reflection in the x-axis of the image represented by " }{TEXT 264 5 "list\n" }{TEXT -1 2 "\nt" }{TEXT 265 15 "rans(list, a, b" }{TEXT -1 54 ") -- This proced ure translates the image represnted by" }{TEXT 266 6 " list " }{TEXT -1 3 "by " }{TEXT 267 2 "a " }{TEXT -1 23 "units horizontally and " } {TEXT 268 1 "b" }{TEXT -1 20 " units vertically.\n\n" }{TEXT 269 16 "r ot(list, theta)" }{TEXT -1 52 " -- This procedure rotates the image re presented by " }{TEXT 270 5 "list " }{TEXT -1 3 "by " }{TEXT 271 5 "th eta" }{TEXT -1 46 " radians counterclockwise around the origin.\n\n" } {TEXT 272 15 "dilate(list, a)" }{TEXT -1 50 " -- This procedure dilate s an image represented by" }{TEXT 273 5 " list" }{TEXT -1 15 " by the \+ factor " }{TEXT 274 1 "a" }{TEXT -1 3 ".\n\n" }{TEXT 275 12 "ident(lis t) " }{TEXT -1 49 "-- This procedure leaves the image represented by" }{TEXT 276 5 " list" }{TEXT -1 9 " alone.\n\n" }{TEXT 277 26 "Evaluate the next cell now" }{TEXT -1 2 ".\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 839 "with('plots'):\n\n plotcurve := proc(lst, n)\n \+ plot(lst, -n..n, -n..n, scaling = CONSTRAINED)\n end: \n\n mirrorpt \+ := x -> [x[1], -x[2]]:\n transpt := (x, a, b) -> [x[1] + a, x[2] + b ]:\n rotpt := (x, theta) -> [x[1] * cos(theta) - x[2] * sin(theta) ,\n x[1] * sin(theta) + x[2] * cos(theta)]: \n dilatept := (x, a) -> [x[1] * a, x[2] * a]:\n identpt := x -> x: \n\n mirror := x -> [seq(mirrorpt(j), j=x)]:\n trans := (x, a, \+ b) -> [seq(transpt(j, a, b), j=x)]:\n rot := (x, theta) -> [seq (rotpt(j, theta), j=x)]:\n dilate := (x, a) -> [seq(dilatept(j, a), j=x)]:\n ident := x -> x:\n\n plotcurves := proc(x, y, n) local blk, rd;\n blk := plot(x, -n..n, -n..n, scaling=CONSTRAINED, colo r=black);\n rd := plot(y, -n..n, -n..n, scaling=CONSTRAINED, colo r=red);\n display([blk, rd]);\n end:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 78 "The next cell illustrates how these procedures are used to work with images. " }{TEXT 278 16 " Evaluate it now." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 114 "a := [[1,2], [2,1], [3,2]]:\n\n plotcurve(a , 3);\n\n plotcurves(a, mirror(a), 3);\n\n plotcurves(a, dilate(a, 2 ), 8);" }}}}{MARK "0 0 0" 27 }{VIEWOPTS 1 1 0 1 1 1803 }