| 53 |
|
|
| 54 |
|
for (p=0;p<n;p++) |
| 55 |
|
{ |
| 56 |
< |
if( (p == u) || (p == v) || (p == w) ) continue; |
| 56 |
> |
if( (p == u) | (p == v) | (p == w) ) continue; |
| 57 |
|
Px = contour->v[V[p]].mX; |
| 58 |
|
Py = contour->v[V[p]].mY; |
| 59 |
|
if (insideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py)) return false; |
| 133 |
|
|
| 134 |
|
/* we want a counter-clockwise polygon in V */ |
| 135 |
|
|
| 136 |
< |
if ( 0.0 < Area(contour) ) |
| 136 |
> |
if ( 0.0 < polyArea(contour) ) |
| 137 |
|
for (v=0; v<contour->nv; v++) V[v] = v; |
| 138 |
|
else |
| 139 |
|
for(v=0; v<contour->nv; v++) V[v] = (contour->nv-1)-v; |
| 146 |
|
for(m=0, v=nv-1; nv>2; ) |
| 147 |
|
{ |
| 148 |
|
/* if we loop, it is probably a non-simple polygon */ |
| 149 |
< |
if (0 >= (count--)) |
| 149 |
> |
if (0 >= count--) |
| 150 |
|
{ |
| 151 |
< |
/* Triangulate: ERROR - probable bad polygon! */ |
| 151 |
> |
/* Triangulate: ERROR - probable bad polygon */ |
| 152 |
|
return false; |
| 153 |
|
} |
| 154 |
|
|
| 165 |
|
a = V[u]; b = V[v]; c = V[w]; |
| 166 |
|
|
| 167 |
|
/* output Triangle */ |
| 168 |
< |
(*cb)(contour, a, b, c); |
| 168 |
> |
if (!(*cb)(contour, a, b, c)) return false; |
| 169 |
|
|
| 170 |
|
m++; |
| 171 |
|
|
| 172 |
|
/* remove v from remaining polygon */ |
| 173 |
|
for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--; |
| 174 |
|
|
| 175 |
< |
/* resest error detection counter */ |
| 175 |
> |
/* reset error detection counter */ |
| 176 |
|
count = 2*nv; |
| 177 |
|
} |
| 178 |
|
} |