CindyJS

Cindy JS Example

Tracing state:

This demo relies on the fact that currently free points snap to grid, but points on lines do not. This allows observing snapping and non-snapping behavior in a single widget.

Things to check:

  1. Moving A down so that the circle no longer intersects the line, and then back up so that it intersects the line again, the point of intersection switches between left and right half of the circle. This demonstrates the basic operation of tracing.

  2. Moving A to the tangential situation should snap to that position thanks to the snap to grid feature. Releasing the mouse there and then pressing it again to move the point back should leave the point on the same half of the circle where it was before, as tracing continues from a position before the tangential one even if the mouse was released in between.

  3. Conversely, releasing A in the tangential situation and then dragging the point further down before going up again will cause the point to change sides. One may release the point again in the singular situation while going back, without affecting the outcome. Note that the mouse has to move down far enough to actually move A away from the snapped singular situation.

  4. As B is restricted to a line, it currently does not snap to the grid. Moving the point down to the singular situation, the script will restrict its movement. As the mouse movement and the script are taken together, the last non-singular position has to be one where B is located further up. Since tracing continues from that, it will preserve the side of the point of intersection.

  5. Moving C is similar to moving B. But instead of just restricting the movement, the script for C deliberately moves the point a good deal into the complex situation, and explicitely requests that the next tracing operation starts from that situation. As a consequence, moving the point to the tangential situation and back up again should cause the point of intersection to always switch sides. The complex situation used as a checkpoint will get printed to the web console.