Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Clipper Class Reference

Clips homogeneous coordinates to the display frustrum [-1, 1] x [-1, 1] x [0, 1]. More...

#include <Clipper.h>

Inheritance diagram for Clipper:

MyClip EPSRenderer

List of all members.


Public Members

 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.


Protected Members

HPoint lastP
Int lastOutcode
BdryCoords lastBC

Detailed Description

Clips homogeneous coordinates to the display frustrum [-1, 1] x [-1, 1] x [0, 1].

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.


Constructor & Destructor Documentation

Clipper::Clipper ()

Definition at line 41 of file Clipper.cc.


Member Function Documentation

Void Clipper::ClipPoint (const HPoint & p, Bool draw)

draw == false: move to p; draw == true: draw to p.

Definition at line 47 of file Clipper.cc.

Void Clipper::ViewPoint (const HPoint & p, Bool draw) [inline, pure virtual]

override to do actual drawing.

Reimplemented in EPSRenderer, and MyClip.


Member Data Documentation

BdryCoords Clipper::lastBC [protected]

Definition at line 38 of file Clipper.h.

Int Clipper::lastOutcode [protected]

Definition at line 37 of file Clipper.h.

HPoint Clipper::lastP [protected]

Definition at line 36 of file Clipper.h.


The documentation for this class was generated from the following files:
Generated at Sat Aug 5 00:17:05 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000