21 #ifndef POLYPARTITION_H
22 #define POLYPARTITION_H
27 typedef double tppl_float;
54 TPPLPoint operator * (
const tppl_float f )
const {
61 TPPLPoint operator / (
const tppl_float f )
const {
68 bool operator==(
const TPPLPoint& p)
const {
69 if((x == p.x)&&(y==p.y))
return true;
73 bool operator!=(
const TPPLPoint& p)
const {
74 if((x == p.x)&&(y==p.y))
return false;
106 void SetHole(
bool hole) {
126 void Init(
long numpoints);
139 int GetOrientation();
145 void SetOrientation(
int orientation);
151 struct PartitionVertex {
158 PartitionVertex *previous;
159 PartitionVertex *next;
164 struct MonotoneVertex {
171 MonotoneVertex *vertices;
173 VertexSorter(MonotoneVertex *v) : vertices(v) {}
174 bool operator() (
long index1,
long index2);
193 std::list<Diagonal> pairs;
197 struct ScanLineEdge {
203 bool operator< (
const ScanLineEdge & other)
const;
214 bool InCone(PartitionVertex *v,
TPPLPoint &p);
222 void UpdateVertexReflexity(PartitionVertex *v);
223 void UpdateVertex(PartitionVertex *v,PartitionVertex *vertices,
long numvertices);
226 void UpdateState(
long a,
long b,
long w,
long i,
long j, DPState2 **dpstates);
227 void TypeA(
long i,
long j,
long k, PartitionVertex *vertices, DPState2 **dpstates);
228 void TypeB(
long i,
long j,
long k, PartitionVertex *vertices, DPState2 **dpstates);
232 void AddDiagonal(MonotoneVertex *vertices,
long *numvertices,
long index1,
long index2,
233 char *vertextypes, std::set<ScanLineEdge>::iterator *edgeTreeIterators,
234 std::set<ScanLineEdge> *edgeTree,
long *helpers);
237 int TriangulateMonotone(
TPPLPoly *inPoly, std::list<TPPLPoly> *triangles);
251 int RemoveHoles(std::list<TPPLPoly> *inpolys, std::list<TPPLPoly> *outpolys);
261 int Triangulate_EC(
TPPLPoly *poly, std::list<TPPLPoly> *triangles);
273 int Triangulate_EC(std::list<TPPLPoly> *inpolys, std::list<TPPLPoly> *triangles);
283 int Triangulate_OPT(
TPPLPoly *poly, std::list<TPPLPoly> *triangles);
293 int Triangulate_MONO(
TPPLPoly *poly, std::list<TPPLPoly> *triangles);
304 int Triangulate_MONO(std::list<TPPLPoly> *inpolys, std::list<TPPLPoly> *triangles);
315 int MonotonePartition(std::list<TPPLPoly> *inpolys, std::list<TPPLPoly> *monotonePolys);
328 int ConvexPartition_HM(
TPPLPoly *poly, std::list<TPPLPoly> *parts);
342 int ConvexPartition_HM(std::list<TPPLPoly> *inpolys, std::list<TPPLPoly> *parts);
353 int ConvexPartition_OPT(
TPPLPoly *poly, std::list<TPPLPoly> *parts);