diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-18 18:36:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-18 18:36:56 +0400 |
commit | d7542be6ac455f48458f8d3f64bcea41dd22f070 (patch) | |
tree | 322a29c0396903734eed65fb7e6e4aa1541613a6 | |
parent | abcaec0edcb6d0ffdc75d210a7d0f08282a3098e (diff) |
code cleanup: more minor changes to scanfill
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index d2d451dc0ce..20dbf29f6bc 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -405,7 +405,9 @@ static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve) miny = eed->v2->xy[1]; maxy = eed->v1->xy[1]; } - if (eve->xy[1] >= miny && eve->xy[1] <= maxy) return 1; + if (eve->xy[1] >= miny && eve->xy[1] <= maxy) { + return 1; + } } return 0; } @@ -503,7 +505,6 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) ScanFillVertLink *sc = NULL, *sc1; ScanFillVert *eve, *v1, *v2, *v3; ScanFillEdge *eed, *nexted, *ed1, *ed2, *ed3; - float miny = 0.0; int a, b, verts, maxface, totface; short nr, test, twoconnected = 0; @@ -527,23 +528,21 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) /* STEP 0: remove zero sized edges */ eed = sf_ctx->filledgebase.first; while (eed) { - if (eed->v1->xy[0] == eed->v2->xy[0]) { - if (eed->v1->xy[1] == eed->v2->xy[1]) { - if (eed->v1->f == SF_VERT_ZERO_LEN && eed->v2->f != SF_VERT_ZERO_LEN) { - eed->v2->f = SF_VERT_ZERO_LEN; - eed->v2->tmp.v = eed->v1->tmp.v; - } - else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f != SF_VERT_ZERO_LEN) { - eed->v1->f = SF_VERT_ZERO_LEN; - eed->v1->tmp.v = eed->v2->tmp.v; - } - else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f == SF_VERT_ZERO_LEN) { - eed->v1->tmp.v = eed->v2->tmp.v; - } - else { - eed->v2->f = SF_VERT_ZERO_LEN; - eed->v2->tmp.v = eed->v1; - } + if (equals_v2v2(eed->v1->xy, eed->v2->xy)) { + if (eed->v1->f == SF_VERT_ZERO_LEN && eed->v2->f != SF_VERT_ZERO_LEN) { + eed->v2->f = SF_VERT_ZERO_LEN; + eed->v2->tmp.v = eed->v1->tmp.v; + } + else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f != SF_VERT_ZERO_LEN) { + eed->v1->f = SF_VERT_ZERO_LEN; + eed->v1->tmp.v = eed->v2->tmp.v; + } + else if (eed->v2->f == SF_VERT_ZERO_LEN && eed->v1->f == SF_VERT_ZERO_LEN) { + eed->v1->tmp.v = eed->v2->tmp.v; + } + else { + eed->v2->f = SF_VERT_ZERO_LEN; + eed->v2->tmp.v = eed->v1; } } eed = eed->next; @@ -651,13 +650,14 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) } else { /* test rest of vertices */ + float miny; v1 = ed1->v2; v2 = ed1->v1; v3 = ed2->v2; /* this happens with a serial of overlapping edges */ if (v1 == v2 || v2 == v3) break; /* printf("test verts %x %x %x\n",v1,v2,v3); */ - miny = ( (v1->xy[1]) < (v3->xy[1]) ? (v1->xy[1]) : (v3->xy[1]) ); + miny = minf(v1->xy[1], v3->xy[1]); /* miny= MIN2(v1->xy[1],v3->xy[1]); */ sc1 = sc + 1; test = 0; |