Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
FelkelIntersection.h
1 //
2 // FelkelIntersection.h: interface for the CIntersection class.
3 //
4 // Copyright (c) 2003-2011 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 // Straight skeleton algorithm and original implementation
8 // courtesy of Petr Felkel and Stepan Obdrzalek (petr.felkel@tiani.com)
9 // Re-implemented for the Virtual Terrain Project (vterrain.org)
10 // by Roger James (www.beardandsandals.co.uk)
11 //
12 
13 #ifndef FELKELINTERSECTIONH
14 #define FELKELINTERSECTIONH
15 
16 #include <queue>
17 
18 #include "FelkelComponents.h"
19 class CSkeleton;
20 
21 typedef priority_queue <CIntersection, deque <CIntersection>, greater <CIntersection> > IntersectionQueue;
22 
24 {
25 public:
26  CIntersection (void) { };
28 
29  void ApplyNonconvexIntersection(CSkeleton &skeleton, CVertexList &vl, IntersectionQueue &iq, bool bCheckVertexinCurrentContour);
30  void ApplyConvexIntersection(CSkeleton &skeleton, CVertexList &vl, IntersectionQueue &iq);
31  void ApplyLast3(CSkeleton &skeleton, CVertexList &vl);
32 
33  C3DPoint m_poi;
34  CVertex *m_leftVertex, *m_rightVertex;
35  CNumber m_height;
36  enum Type { CONVEX, NONCONVEX } m_type;
37 
38  bool operator > (const CIntersection &i) const
39  {
40  // Do exact comparison for intersection queue
41  // Using CNumber will also test for != which is implemented as !SIMILAR
42  double d1 = m_height;
43  double d2 = i.m_height;
44  return d1 > d2;
45  }
46  bool operator == (const CIntersection &i) const
47  {
48  return m_poi == i.m_poi;
49  }
50 };
51 
52 #endif // FELKELINTERSECTIONH