PolyHackDoc.tioga
Spreitzer, June 9, 1985 6:14:23 pm PDT
PolyHack
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
PolyHack
Mike Spreitzer
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: This is a collection of graphics hacks, centered around the idea of polygons whose vertices move through time.
Created by: Mike Spreitzer
Maintained by: Mike Spreitzer <Spreitzer.pa>
Keywords: Polygon Hacks
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. The Basic Theory
The PolyHack has a list of "moving polygons". A moving polygon is a coloringed sequence of moving vertices. A moving vertex is a function that maps a time (a real number) to a point (in 2-D Euclidean space). A coloring is a function that maps a time to (the Imager's opinion of) a color.
The basic operation of the PolyHack is to step through time, and at each time step do a certain operation (determined by the PolyHack's "mode") on its list of moving polygons. The PolyHack can be in one of four modes:
sweep
For each moving polygon edge, fill the area swept out by that edge as it moved over the previous time step. The Alto programs called "Tachy" are built out of this operation. The color "invert" is the most interesting one to use here.
outline
For each moving polygon, draw its outline. XDE has a DMT that does something like this.
fill
For each moving polygon, paint its interior. An interesting hack has been built out of this for SUN workstations. It uses a single moving rectangle, each of whose edges traces a sinusoid in its dimension. Here again, the color invert is best used.
trace
For each moving polygon vertex, draw a line from its previous location to its new location. This can be used to emulate Spirograph. This is most interesting on the color display, when a non-gray color map (anybody know how to get one?) is being used.
The user constructs moving polygons with Misp expressions. The PolyHack registers with Misp some values for this purpose. They are listed later. It also executes the file "PolyHack.preLoad", which defines some more useful values (and some experimental ones too --- see if you can guess which are which).
In the viewer created by the PolyHack, the mouse buttons mean:
Left => Start continuous operation,
Middle => Set the PolyHack's list of moving polygons to be the Misp value of the current Tioga selection,
Right => Clear the display;
unless the PolyHack is in operation at the time the mouse button is clicked --- in that case it means to interrupt operation.
2. PolyHack Misp values
(ClosedPoly Coloring Vertex*). . . => Poly
(OpenPoly Coloring Vertex*)    => Poly
(ListPoly close: Boolean color: Coloring vertices: VertexList). => Poly
(StarHack nVerts, nSteps: Int)    => VertexList
(StarHackWithBounds nVerts, nSteps: Int)  => (a, ab, b:VertexList)
(RandomBouncePoly [nVerts xmax ymax dxmax dymax]). => Poly
(RandomBounce [xmax ymax dxmax dymax])  => Vertex
(Bounce [x y dx dy xmin ymin xmax ymax]). . => Vertex
(Wheel [radius where initial pen])   => Wheel
(Point x y). . . . . => Point
(Spiro center stepSize (Wheel+))   => Vertex
(Liss xBase xAmpl xStep xTheta yBase yAmpl yStep yTheta). => Vertex
(Constant x y)     => Vertex
(Sum Vertex+). . . . . => Vertex
(OldSum Vertex+)     => Vertex
(Series VertexList [typRadius: Real]). . . => VertexList
(HalveFirst Poly)     => Poly
(HalveLast Poly). . . . . => Poly
(Choose min, max: Number)    => Int
(fromRGB r g b: Real). . . . => Color
(fromHSV h s v: Real)    => Color
(Coloring function). . . . . => Coloring
(Load fileName: ROPE)    => $T
(Print x: REF ANY). . . . => x
(SetMode mode: Mode)    => oldMode
(SetSpeed speed: Number). . . . => oldSpeed
(SetPolys UNION[Poly, PolyList]). . . => $T
(DrawPolys UNION[Poly, PolyList]). . . => polyList
(Run steps: Int)     => $T
(Stop). . . . . . => stop
black, white, red, green, blue, megenta, yellow, cyan, invert => the Color