Vispatch Tutorial (using Java 1.02) > TOC > The Vispatch Visual Language > Bodies of Rules > Generators

Generators

To place a figure at a new location in the document, generator figures are used. Vispatch currently implements two types of generator figures. The first of these is called GenRotate and looks like a small circle around an X. The second type of generator figure is called GenXY and looks like a small square that encloses an X.

To illustrate the difference in how these generators create new points, the applet below includes a rule that draws two triangles in response to a mouse drag. The left scope figures contains several examples of figures produced by this rule. The red arrow in each example shows the length and direction of the mouse drag that the rule processed.

 
Both GenRotate and GenXY produce points that depend on the start and end points of the mouse drag. Points generated with GenRotate rotate with the direction of the mouse drag and scale proportionately with the length of the mouse drag. This can be seen by looking at the smaller triangles, which were created by GenRotate.

In contrast, GenXY produces points that scale independently in the X and Y directions such that they are proportional to the X and Y distances covered by the mouse drag. For example, the larger triangles formed from dashed lines (i.e. equiv line figures) were created by GenXY. Notice how they become compressed horizontally as the mouse drag covers less X distance in the examples labeled "Same Y". Notice also that horizontal and vertical mouse drags cause GenXY to produce points that fall on the same line as the mouse drag. In the figure above, this causes the larger triangle to be hidden (mostly) below the red arrow.