home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 3 / RISC_DISC_3.iso / resources / etexts / gems / gemsv / ch7_4 / dedge.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-22  |  1.1 KB  |  41 lines

  1. // -*- C++ -*-
  2. // dedge.h by George Vanecek Jr, June 1994
  3.  
  4. #ifndef _DEDGE_H_
  5. #define _DEDGE_H_
  6.  
  7. #ifndef _POINT_H_
  8. #include "point.h"
  9. #endif
  10.  
  11. class DEdge {            // Directed Edge
  12. public:
  13.   DEdge ( const Point& srcP )
  14.   : sP(srcP), nxt(this), prv(this), sPW(NOWHERE) { }
  15.   DEdge*           next( ) const { return nxt; }
  16.   DEdge*           prev( ) const { return prv; }
  17.   const Point& srcPoint( ) const { return sP; }
  18.   const Point& dstPoint( ) const { return nxt->sP; }
  19.   Where&       srcWhere( ) { return sPW; }
  20.   Where&       dstWhere( ) { return nxt->sPW; }
  21.   Where           where( ) const { return Where( sPW | nxt->sPW ); }
  22.   double&  distFromRefP( ) { return t; }
  23.   
  24. private:
  25.   DEdge ( const Point& srcP, DEdge* const last );
  26.   static void closeCycle( DEdge* const first, DEdge* const last );
  27.   void        split     ( const Point& );
  28.  
  29.   DEdge*      nxt;        // Next DEdge on cycle
  30.   DEdge*      prv;        // Previous DEdge on cycle
  31.   const Point sP;        // Source Point
  32.   Where       sPW;        // Where is Source Point?
  33.   double      t;        // Related to sP. Used in complexCut(...)
  34.  
  35. friend class Polygon;
  36. };
  37.  
  38. typedef DEdge* DEdgePtr;
  39.  
  40. #endif
  41.