Program 7.5: Surface

This is a straightforward reinterpretation of Program 7.5. The viewing angles are hard-coded, as in the orginal, but the viewport is considerably bigger. The main difference in structure is that the drawing routine can be broken out into actual subroutines.

The clipping routines were kept even though they arn't strictly necessary since the canvas will clip anyway. Likewise, the translation of the points could have been done using canvas primitives.

The other obvious difference is that this takes essentially no time to draw on a modern computer whereas it took minutes to draw on the Apple ][.

And since it takes no time, we can make it spin.

One interesting effect is that the viewport clipping is more obvious as the viewer position changes.