This is a quick guide to get started. Some of the things in zone need other programs. This is a guide to that. linmap.ps warpmap3.ps \ ! \ /----------------+------+ ! ! ! zone.ps +---spherewarp.ps or +---latlongwarp.ps or +---sphere2warp.ps or +---cylnderwarp.ps or +---butterflywarp.ps breakpath.ps spherewarp.ps, sphere2warp.ps, cylinderwarp.ps, butterflywarp.ps, and latlongwarp.ps are warp files. Any one of them can be included anywhere which calls for a warp file. When one file requires another, you can concatenate them with the unix command 'cat' or insert them after each other in your favorite editor. For example, you might type: cat zone.ps spherewarp.ps warpmap3.ps breakpath.ps ex_warp2.ps > fullex_warp2.ps to get a file fullex_warp2.ps that will execute correctly. ZONE EXAMPLE: ============= ex_zone.ps requires zone.ps linmap.ps This example demonstrates using the 3D operators to draw images in three dimensions. Here a huge penguin is pretending to be Godzilla by knocking around some skyscrapers in 3D. The procedures Box, Wall, and Building are all real 3D procedures. The different skyscrapers are all drawn from the same procedure, but scaled, translated, and rotated. The procedure "penguin" is really a normal 2D procedure. However by using the algorithms in linmap.ps, we draw this 2D image on a plane which we place inside 3D space. So although the penguin drawing is still very "flat", it will be rotated and scaled properly along with everything else in the 3D area. THINGS TO TRY: Try uncommenting some of the lines in the procedure altview which changes how the 3D space is viewed. Try any 3D operators you like. Try replacing the penguin procedure with some other 2D algorithm. Try altering the parameters and moving the buildings around. To all appearances, the penguin is knocking a building with his hand which is falling on another building which in turn is falling onto another building. Try rotating the view and looking around to see if the buildings are really touching in 3D space. LINMAP EXAMPLE: =============== ex_linmap.ps requires zone.ps linmap.ps This is an example of how to take a normal postscript file like ex_norm.ps and convert it to something in 3-space. WARP EXAMPLES: ============== EXAMPLE 1: ex_warp1.ps ex_warp1.ps requires zone.ps [ a warp file ] warpmap3.ps This shows off the neat warping. It's from the same normal postscript file in ex_norm.ps and ex_linmap.ps. The algorithm "warppath" takes the current 2D path, transforms it into 3D based on the the given "warp file" and creates a new 2D path based on the projection of the 3D image to the device page. THINGS TO TRY: Adjust the rotates and scales with different warp files to achieve various effects. EXAMPLE 2: ex_warp2.ps ex_warp2.ps requires zone.ps [ a warp file ] warpmap3.ps breakpath.ps This example demonstrates checkerboarding and wrapping 2D areas into 3D space. The drawing is done completely in 2D, however the algorithm in the warp file used converts this 2D image to a representation in virtual 3D space. This representation is not just a limited projection but a real mapping into virtual 3D space that can be combined with other 3D operators such as rotatex3 and translatex3. The main 2D drawing is made with the simple procedures Box, Shape, Shape2, Shape3, and Grid. These can be of arbitrary complexity, including rotate, gsave, arcto, and any other normal PostScript operators except perhaps clip, charpath, and image. Once a normal PostScript 2D path has been constructed, but BEFORE we apply an operator such as "stroke" or "fill", we must warp this path into a new path. We instead say "warppath stroke" or "warppath fill". "warppath fill" works by altering the vertices of the bounding path and then filling the new warped bounding path. For a more accurate warp use WarpFill, which actually breaks paths up into tiny regions and warps each one. THINGS TO TRY: Try adjusting the margins, the delta, and flipping the booleans evenod and fillout. Also, try removing warping entirely by uncommenting the line marked 'uncomment this to remove warping'. Feel free to try rotating, translating, or scaling the image as it is view in 3D space also with the 3D operators. Try uncommenting the bug example just to see how it looks. EXAMPLE 3: ========== ex_warpclock.ps requires zone.ps [ a warp file here is optional ] warpmap3.ps This example demonstrates alternate uses for the warping algorithms in warpmap3.ps. It draws a simple clock, using the warppath algorithm to alter the current path before any stroking or filling. Because the warping algorithms happen to involve using 3 space, you must include zone.ps. THINGS TO TRY: There is a line where it says "/warp3 {warpF} def". WarpF is the standard "do nothing" warp. If you delete this line entirely then the warp will be whatever is described in the given warp file. Also, try replacing "warpF" with any of the other warps defined: warpA, warpB, warpC, warpD, and warpE. Also, for on-line simulation only (not for printing on a printer), try changing the definition of movehands so that it is true. This will cause the hands on the clock to move, a nice effect. To define your own warps, make a procedure that accepts "x y" from the stack and returns "x' y' z'", a 3D space point. Feel free to use any 3D operators to change the way the 3D space point is perceived. BREAKPATH EXAMPLES: =================== EXAMPLE1 ex_break.ps requires breakpath.ps This example demonstrates three alternate uses for the tiling algorithms in breakpath.ps. The procedure "Dotties" takes the current 2D path, flattens it, and places a small dot at each vertex. CheeseIt takes the current 2D path, flattens it, and places a small dot everywhere that a line y=ConstantY crosses the path. A number of these parallel ConstantY lines are spaced evenly apart. Parse takes a string and attempts to fill it inside the current path. You must call InitWord after drawing the path, but before using Parse. Dotties, CheeseIt, and Parse are all independent and do not depend on each other. "flattening" a path just means turning the curves into successive line approximations, and does not imply any kind of 3D transform or curve smoothing. THINGS TO TRY: Try inserting your own arbitrary path in place of Yin-Yang. Try adjusting the delta or margins, and try flipping the booleans evenodd and fillout. Try to get an understanding of how the tiling algorithms are used by this example file (which is itself complex).