#7 Better conform to C89
This commit is contained in:
parent
59b61f2c13
commit
c655ececd5
4 changed files with 18 additions and 11 deletions
|
@ -116,7 +116,7 @@ enum TessElementType
|
|||
TESS_POLYGONS,
|
||||
TESS_CONNECTED_POLYGONS,
|
||||
TESS_BOUNDARY_CONTOURS,
|
||||
TESS_CONSTRAINED_DELAUNAY_TRIANGLES,
|
||||
TESS_CONSTRAINED_DELAUNAY_TRIANGLES
|
||||
};
|
||||
|
||||
typedef float TESSreal;
|
||||
|
|
|
@ -266,10 +266,16 @@ void tesedgeIntersect( TESSvertex *o1, TESSvertex *d1,
|
|||
*/
|
||||
TESSreal calcAngle( TESSvertex *v0, TESSvertex *v1, TESSvertex *v2 )
|
||||
{
|
||||
TESSreal a[2] = { v2->s - v1->s, v2->t - v1->t };
|
||||
TESSreal b[2] = { v0->s - v1->s, v0->t - v1->t };
|
||||
TESSreal num = a[0] * b[0] + a[1] * b[1];
|
||||
TESSreal den = sqrt( a[0] * a[0] + a[1] * a[1] ) * sqrt( b[0] * b[0] + b[1] * b[1] );
|
||||
TESSreal num;
|
||||
TESSreal den;
|
||||
TESSreal a[2];
|
||||
TESSreal b[2];
|
||||
a[0] = v2->s - v1->s;
|
||||
a[1] = v2->t - v1->t;
|
||||
b[0] = v0->s - v1->s;
|
||||
b[1] = v0->t - v1->t;
|
||||
num = a[0] * b[0] + a[1] * b[1];
|
||||
den = sqrt( a[0] * a[0] + a[1] * a[1] ) * sqrt( b[0] * b[0] + b[1] * b[1] );
|
||||
if ( den > 0.0 ) num /= den;
|
||||
if ( num < -1.0 ) num = -1.0;
|
||||
if ( num > 1.0 ) num = 1.0;
|
||||
|
|
|
@ -752,16 +752,12 @@ int tessMeshMergeConvexFaces( TESSmesh *mesh, int maxVertsPerFace )
|
|||
|
||||
void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge )
|
||||
{
|
||||
assert(EdgeIsInternal(edge));
|
||||
|
||||
TESShalfEdge *a0 = edge;
|
||||
TESShalfEdge *a1 = a0->Lnext;
|
||||
TESShalfEdge *a2 = a1->Lnext;
|
||||
assert(a2->Lnext == a0);
|
||||
TESShalfEdge *b0 = edge->Sym;
|
||||
TESShalfEdge *b1 = b0->Lnext;
|
||||
TESShalfEdge *b2 = b1->Lnext;
|
||||
assert(b2->Lnext == b0);
|
||||
|
||||
TESSvertex *aOrg = a0->Org;
|
||||
TESSvertex *aOpp = a2->Org;
|
||||
|
@ -771,6 +767,10 @@ void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge )
|
|||
TESSface *fa = a0->Lface;
|
||||
TESSface *fb = b0->Lface;
|
||||
|
||||
assert(EdgeIsInternal(edge));
|
||||
assert(a2->Lnext == a0);
|
||||
assert(b2->Lnext == b0);
|
||||
|
||||
a0->Org = bOpp;
|
||||
a0->Onext = b1->Sym;
|
||||
b0->Org = aOpp;
|
||||
|
|
|
@ -452,9 +452,9 @@ int tessMeshRefineDelaunay( TESSmesh *mesh, TESSalloc *alloc )
|
|||
*/
|
||||
TESSface *f;
|
||||
EdgeStack stack;
|
||||
stackInit(&stack, alloc);
|
||||
TESShalfEdge *e;
|
||||
TESShalfEdge *edges[4];
|
||||
stackInit(&stack, alloc);
|
||||
for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) {
|
||||
if ( f->inside) {
|
||||
e = f->anEdge;
|
||||
|
@ -473,13 +473,14 @@ int tessMeshRefineDelaunay( TESSmesh *mesh, TESSalloc *alloc )
|
|||
e = stackPop(&stack);
|
||||
e->mark = e->Sym->mark = 0;
|
||||
if (!tesedgeIsLocallyDelaunay(e)) {
|
||||
int i;
|
||||
tessMeshFlipEdge(mesh, e);
|
||||
// for each opposite edge
|
||||
edges[0] = e->Lnext;
|
||||
edges[1] = e->Lprev;
|
||||
edges[2] = e->Sym->Lnext;
|
||||
edges[3] = e->Sym->Lprev;
|
||||
for (int i=0;i<3;i++) {
|
||||
for (i=0;i<3;i++) {
|
||||
if (!edges[i]->mark && EdgeIsInternal(edges[i])) {
|
||||
edges[i]->mark = edges[i]->Sym->mark = 1;
|
||||
stackPush(&stack, edges[i]);
|
||||
|
|
Loading…
Add table
Reference in a new issue