00001 /* 00002 File: Clipper.h 00003 00004 Function: Clips homogeneous coordinates to the display frustrum 00005 (x, y, z) E [-1, 1] x [-1, 1] x [0, 1] 00006 00007 The standard display pipeline is transform, clip, project, 00008 2D draw. The Clipper class should be passed post-transform 00009 homogeneous coordinates. It will in turn call ViewPoint() 00010 with clipped coordinates. You should override ViewPoint() 00011 to perform the homogeneous divide, map to display coords, 00012 and do the drawing. 00013 00014 Author: Andrew Willmott 00015 00016 Copyright: (c) 1998-2000, Andrew Willmott 00017 */ 00018 00019 00020 #ifndef __Clipper__ 00021 #define __Clipper__ 00022 00023 #include "gcl/Geometry.h" 00024 00025 typedef GCLReal BdryCoords[6]; 00026 00027 class Clipper 00028 { 00029 public: 00030 Clipper(); 00031 Void ClipPoint(const HPoint &p, Bool draw); 00033 virtual Void ViewPoint(const HPoint &p, Bool draw) = 0; 00035 protected: 00036 HPoint lastP; 00037 Int lastOutcode; 00038 BdryCoords lastBC; 00039 }; 00040 00041 #endif