8#ifndef COVISE_TRIANGULATE_H
9#define COVISE_TRIANGULATE_H
13static const float EPSILON = 0.0000000001f;
36 int n = (int)contour.size();
44 if (0.0f <
Area(contour))
45 for (
int v = 0;
v <
n;
v++)
48 for (
int v = 0;
v <
n;
v++)
56 for (
int m = 0,
v = nv - 1; nv > 2;)
76 if (
Snip(contour, u,
v,
w, nv, V))
93 for (
s =
v,
t =
v + 1;
t < nv;
s++,
t++)
111 int n = (int)contour.size();
115 for (
int p =
n - 1,
q = 0;
q <
n;
p =
q++)
117 A += contour[
p].x * contour[
q].y - contour[
q].x * contour[
p].y;
129 float ax, ay, bx,
by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
130 float cCROSSap, bCROSScp, aCROSSbp;
145 aCROSSbp = ax * bpy - ay * bpx;
146 cCROSSap = cx * apy - cy * apx;
147 bCROSScp = bx * cpy -
by * cpx;
149 return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
156 float Ax, Ay, Bx, By, Cx, Cy, Px, Py;
158 Ax = contour[V[u]].x;
159 Ay = contour[V[u]].y;
161 Bx = contour[V[
v]].x;
162 By = contour[V[
v]].y;
164 Cx = contour[V[
w]].x;
165 Cy = contour[V[
w]].y;
167 if (
EPSILON > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax))))
170 for (
p = 0;
p <
n;
p++)
172 if ((
p == u) || (
p ==
v) || (
p ==
w))
174 Px = contour[V[
p]].x;
175 Py = contour[V[
p]].y;
GLdouble n
Definition: khronos-glext.h:8447
const GLubyte * c
Definition: khronos-glext.h:9864
GLdouble GLdouble GLdouble GLdouble q
Definition: khronos-glext.h:6465
GLuint64EXT * result
Definition: khronos-glext.h:12573
const GLdouble * v
Definition: khronos-glext.h:6442
GLuint index
Definition: khronos-glext.h:6722
GLuint GLuint GLsizei count
Definition: khronos-glext.h:6343
GLdouble GLdouble t
Definition: khronos-glext.h:6449
GLboolean GLboolean GLboolean b
Definition: khronos-glext.h:6895
GLfloat GLfloat p
Definition: khronos-glext.h:9861
GLboolean GLboolean GLboolean GLboolean a
Definition: khronos-glext.h:6895
GLdouble s
Definition: khronos-glext.h:6441
GLubyte GLubyte GLubyte GLubyte w
Definition: khronos-glext.h:6793
GLbyte by
Definition: khronos-glext.h:9725
const GLfloat * m
Definition: khronos-glext.h:12117
std::vector< int > tr_intVector
Definition: Triangulate.h:24
static const float EPSILON
Definition: Triangulate.h:13
std::vector< tr_vertex > tr_vertexVector
Definition: Triangulate.h:22
Definition: Triangulate.h:16
float x
Definition: Triangulate.h:17
float y
Definition: Triangulate.h:18
int index
Definition: Triangulate.h:19
Definition: Triangulate.h:27
static float Area(const tr_vertexVector &contour)
Definition: Triangulate.h:108
static bool Snip(const tr_vertexVector &contour, int u, int v, int w, int n, int *V)
Definition: Triangulate.h:153
static bool Process(const tr_vertexVector &contour, tr_intVector &result)
Definition: Triangulate.h:31
static bool InsideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py)
Definition: Triangulate.h:124