--- ray/src/common/triangulate.c 2014/01/23 23:51:41 2.1 +++ ray/src/common/triangulate.c 2014/01/24 02:22:49 2.3 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: triangulate.c,v 2.1 2014/01/23 23:51:41 greg Exp $"; +static const char RCSid[] = "$Id: triangulate.c,v 2.3 2014/01/24 02:22:49 greg Exp $"; #endif /* * triangulate.c @@ -53,7 +53,7 @@ polySnip(const Vert2_list *contour, int u, int v, int for (p=0;pv[V[p]].mX; Py = contour->v[V[p]].mY; if (insideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py)) return false; @@ -133,7 +133,7 @@ polyTriangulate(const Vert2_list *contour, tri_out_t * /* we want a counter-clockwise polygon in V */ - if ( 0.0 < Area(contour) ) + if ( 0.0 < polyArea(contour) ) for (v=0; vnv; v++) V[v] = v; else for(v=0; vnv; v++) V[v] = (contour->nv-1)-v; @@ -146,9 +146,9 @@ polyTriangulate(const Vert2_list *contour, tri_out_t * for(m=0, v=nv-1; nv>2; ) { /* if we loop, it is probably a non-simple polygon */ - if (0 >= (count--)) + if (0 >= count--) { - /* Triangulate: ERROR - probable bad polygon! */ + /* Triangulate: ERROR - probable bad polygon */ return false; } @@ -165,14 +165,14 @@ polyTriangulate(const Vert2_list *contour, tri_out_t * a = V[u]; b = V[v]; c = V[w]; /* output Triangle */ - (*cb)(contour, a, b, c); + if (!(*cb)(contour, a, b, c)) return false; m++; /* remove v from remaining polygon */ for(s=v,t=v+1;t