Inheritance diagram for Clipper:
|Void||ClipPoint (const HPoint &p, Bool draw)|
|draw == false: move to p; draw == true: draw to p.|
|virtual Void||ViewPoint (const HPoint &p, Bool draw) = 0|
|override to do actual drawing.|
Implements yer bog-standard line clipper. Rewritten a la Jim Blinn's presentation in IEEE CGA, Jan 91. Similar to Cohen-Sutherland, Cyrus-Beck, Liang-Barsky.
Note that this is supposed to come after the display transformations have been applied, but before the final divide by z. It's set up to assume by default that our final display space is the -1,-1 -> 1, 1 square in x, y, and that the near and far clipping planes have been mapped to z = 0 and 1 respectively.
The standard display pipeline is transform, clip, project, 2D draw. The Clipper class should be passed post-transform homogeneous coordinates. It will in turn call ViewPoint() with clipped coordinates. You should override ViewPoint() to perform the homogeneous divide, map to display coords, and do the drawing.
Definition at line 27 of file Clipper.h.
|Void Clipper::ClipPoint (const HPoint & p, Bool draw)|
Void Clipper::ViewPoint (const HPoint & p, Bool draw)|