[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45750] trunk/blender/source/blender/ blenlib/intern/scanfill.c: code cleanup: more minor changes to scanfill

Campbell Barton ideasman42 at gmail.com
Wed Apr 18 16:36:56 CEST 2012


Revision: 45750
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45750
Author:   campbellbarton
Date:     2012-04-18 14:36:56 +0000 (Wed, 18 Apr 2012)
Log Message:
-----------
code cleanup: more minor changes to scanfill

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/scanfill.c

Modified: trunk/blender/source/blender/blenlib/intern/scanfill.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/scanfill.c	2012-04-18 14:30:57 UTC (rev 45749)
+++ trunk/blender/source/blender/blenlib/intern/scanfill.c	2012-04-18 14:36:56 UTC (rev 45750)
@@ -405,7 +405,9 @@
 			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 @@
 	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,24 +528,22 @@
 	/* 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 @@
 			}
 			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;




More information about the Bf-blender-cvs mailing list