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

GenRotate

Intuitively, GenRotate generates a point that scales and rotates according to the length and direction of the mouse drag. More precisely, it generates a new point based on the location of 5 other points. The first two of the points are defined by the mouse drag event. Call these mouseDragBegin and mouseDragEnd. The other three points are in the body of the rule. Two of these points are defined by the two equiv line figures that extend from the drag event figure of the rule's head to locations in the rule's body. (The rule must have these three figures in order for GenRotate to be used.) Call the two points where the two equiv line figures end in the rule body dragInBodyBegin and dragInBodyEnd. The fifth point is the location of the GenRotate figure itself.

GenRotate generates a new point such that the triangle formed by the new point, mouseDragBegin, and mouseDragEnd is similar to the triangle formed by GenRotate, dragInBodyBegin, and dragInBodyEnd. In other words, the two triangles have the same corresponding angles, but may be different sizes.

 
Notice that although the triangles generated by the first rule have different sizes and orientations, they all have the same shape. GenRotate rotates and scales, but it does not distort.

Notice that the lines generated by the second rule have lengths and orientations that only depend on the mouse drag. The length of line from which the mouse drag was performed does affect GenRotate. Notice too that the second rule creates a new line in the same position by using equiv line figures.