diff options
author | neoraider <devnull@localhost> | 2007-09-21 23:47:05 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-09-21 23:47:05 +0200 |
commit | 62e42408485e9e1b7e939925b650a4b2e90ecddb (patch) | |
tree | 9305aa0f7b2d79c35250939beca2c268dd61e23d /Polygon.h | |
parent | 1bce1d8ad7c32ce7b6723a284842b6890cf5209f (diff) | |
download | zoomedit-62e42408485e9e1b7e939925b650a4b2e90ecddb.tar zoomedit-62e42408485e9e1b7e939925b650a4b2e90ecddb.zip |
zoomedit: Big transition Ciaro -> OpenGL, enormous speedup!
Diffstat (limited to 'Polygon.h')
-rw-r--r-- | Polygon.h | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -3,17 +3,39 @@ #include "Vertex.h" #include "Line.h" +#include "Triangle.h" #include <vector> class Polygon : public std::vector<Vertex> { private: + struct Intersection { + size_t va1, va2, vb1, vb2; + Vertex v; + }; + + typedef Triangle::Direction Direction; + int quadrant(const Vertex &v) const; + + double signedArea() const; + + Triangle::Direction getDirection() const; + bool isConcave(const Triangle::Direction &dir, const Vertex &v1, const Vertex &v2, const Vertex &v3) const; + + bool intersections(std::vector<Intersection> *intersections = NULL) const; + + void doTriangulate(std::vector<Triangle> &triangles) const; public: double area() const; double perimeter() const; bool contains(const Vertex &v) const; bool intersects(const Line &l) const; + + bool isSimple() const; + bool simplify(Polygon &polygon) const; + + void triangulate(std::vector<Triangle> &triangles) const; }; #endif /*POLYGON_H_*/ |