CamSketchpad

CamSketchpad is a modern recreation of Ivan Sutherland's seminal Sketchpad program. It's a 2D drawing / CAD program with support for geometrical constraints and the inclusion of instances referencing other drawings.

It was written as a group project for the Cambridge University computer science undergraduate course by a team of seven people: Tom Botterill, Matthew Brown, Tom Craig, Easlyn Kirupairajah, Amit Sarna, Andrew Smee and myself.

Most of my work was on the constraint satisfaction algorithm, which took perhaps 200 hours of staring at error gradient maps, and imbued me with an enormous respect for Sutherland, whose version of Sketchpad performed as well on '60s hardware as ours does on modern computers.

CamSketchpad is far from being as complete and efficient as the original Sketchpad, but it does have all the necessary components in a rudimentary form, and is finished enough to be usable. So we've decided to release it as open source under the BSD licence, so we or others are free to tinker with it and improve its algorithms and user interface.

(See also the further reading and constraints tutorial below.)

The project is now hosted through Sourceforge.



Features
  • Support for containing instances of other drawings in your drawings. Unlike copies, instances will change when the original drawing changes.
  • Highlighting system for displaying what will be selected / snapped to / merged / created when you click.
  • Very simple interface for creating new constraints - just write a function telling CamSketchpad how far away it is from satisfying the constraint. (So when the function returns 0, the constraint is entirely satisfied.)

Screenshots



Constraints Tutorial

As an example of what you can do with constraints, we'll now construct a shape constrained to be a rectangle.

  1. Start up CamSketchpad
  2. Select the Draw Lines tool.
  3. Click into the drawing area, then move the cursor to the right - a line will extend.

  4. Click again, creating the second point of the rectangle.
  5. Move up, click, move left, click - producing all four points.

  6. Move the cursor back over the first point, which will become red, and click. The resulting line snaps to the pre-existing point, giving you a closed shape.

  7. Move the cursor away and right-click or control-click, ending line drawing.
  8. Select "Show Constraints" from the "View" menu.
  9. Click on the Constraints button , which makes the constraints palette appear.

  10. Select a Parallel constraint from the palette and click on the top and bottom lines, constraining those two lines to be parallel.
  11. Select another Parallel constraint and click on the left and right lines. If we stopped now, we'd have a parallelogram. One more thing is required to make this a rectangle - the corners must be right angles.
  12. Select a Perpendicular constraint and click on the left and bottom lines. Now we have three constraints (two overlap in the picture) completely defining what a rectangle is.

  13. Press space to tell CamSketchpad to evaluate the constraints. The skewed shape instantly shifts into the form of a rectangle.

  14. Select the Move tool , and try dragging a point or line and then pressing space again. The shape will instantly become rectangular again. Notice how the constraints impose no limit on the size, proportion, or orientation of the rectangle. (Constraints that do impose such limits can of course be added.)
© 2007, David Stark
Login