Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
PolyChecker.h
1 //
2 // PolyChecker.h: interface for the PolyChecker class by Roger James.
3 //
4 // Copyright (c) 2003 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef POLYCHECKER_H
9 #define POLYCHECKER_H
10 
11 #include "MathTypes.h"
12 
13 // I really need to stop defining this!
14 #define POLYEPSILON 0.000001
15 
17 {
18 public:
19  PolyChecker();
20  virtual ~PolyChecker();
21 
22  bool Xor(bool x, bool y);
23  bool Intersect(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c, const DPoint2 &d);
24  bool IntersectProp(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c, const DPoint2 &d);
25  bool Between(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c);
26  bool Left(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c);
27  bool LeftOn(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c);
28  bool Collinear(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c);
29  double Area2(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c);
30  int AreaSign(const DPoint2 &a, const DPoint2 &b, const DPoint2 &c, double dEpsilon = POLYEPSILON);
31  bool IsSimplePolygon(const DLine2 &vertices);
32  bool IsSimplePolygon(const DLine3 &vertices);
33  bool IsClockwisePolygon(const DLine2 &vertices);
34  bool IsClockwisePolygon(const DLine3 &vertices);
35 
36  bool Intersect(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c, const FPoint2 &d);
37  bool IntersectProp(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c, const FPoint2 &d);
38  bool Between(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c);
39  bool Left(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c);
40  bool LeftOn(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c);
41  bool Collinear(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c);
42  float Area2(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c);
43  int AreaSign(const FPoint2 &a, const FPoint2 &b, const FPoint2 &c, float dEpsilon = POLYEPSILON);
44  bool IsSimplePolygon(const FLine2 &vertices);
45  bool IsSimplePolygon(const FLine3 &vertices);
46  bool IsClockwisePolygon(const FLine2 &vertices);
47  bool IsClockwisePolygon(const FLine3 &vertices);
48 };
49 
50 #endif // POLYCHECKER_H
51