[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17534] branches/projection-paint/source/ blender/src/imagepaint.c: maximum polyline between clipped rectangle and triangle was 6, but in some cases 7 points were set.

Campbell Barton ideasman42 at gmail.com
Sat Nov 22 16:09:17 CET 2008


Revision: 17534
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17534
Author:   campbellbarton
Date:     2008-11-22 16:09:16 +0100 (Sat, 22 Nov 2008)

Log Message:
-----------
maximum polyline between clipped rectangle and triangle was 6, but in some cases 7 points were set. set the maximum size of the polyline at 8 to be safe.

Modified Paths:
--------------
    branches/projection-paint/source/blender/src/imagepaint.c

Modified: branches/projection-paint/source/blender/src/imagepaint.c
===================================================================
--- branches/projection-paint/source/blender/src/imagepaint.c	2008-11-22 14:54:49 UTC (rev 17533)
+++ branches/projection-paint/source/blender/src/imagepaint.c	2008-11-22 15:09:16 UTC (rev 17534)
@@ -1864,8 +1864,8 @@
 		
 		
 		/* Maximum possible 6 intersections when using a rectangle and triangle */
-		float isectVCosSS[6][2];
-		float isectVAngles[6];
+		float isectVCosSS[8][2];
+		float isectVAngles[8];
 		
 		float vClipSS_A[2], vClipSS_B[2]; 
 		
@@ -2054,7 +2054,7 @@
 #endif
 
 
-int IsectPoly2Df(float pt[2], float uv[6][2], int tot)
+int IsectPoly2Df(float pt[2], float uv[8][2], int tot)
 {
 	int i;
 	if (SIDE_OF_LINE(uv[tot-1],uv[0],pt) < 0.0f)
@@ -2109,7 +2109,7 @@
 	
 	int i1,i2,i3;
 	
-	float uv_clip[6][2];
+	float uv_clip[8][2];
 	int uv_clip_tot;
 	
 	vCo[0] = ps->dm_mvert[ (*(&mf->v1    )) ].co;
@@ -2166,6 +2166,11 @@
 				uv_clip, &uv_clip_tot
 		); 
 		
+		/* sometimes this happens, better just allow for 8 intersectiosn even though there should be max 6 */
+		/*
+		if (uv_clip_tot>6) {
+			printf("this should never happen! %d\n", uv_clip_tot);
+		}*/
 		
 
 		if (pixel_bounds_array(uv_clip, min_px, max_px, ibuf->x, ibuf->y, uv_clip_tot )) {
@@ -2210,7 +2215,7 @@
 						has_x_isect = has_isect = 1;
 					} else if (has_x_isect) {
 						/* assuming the face is not a bow-tie - we know we cant intersect again on the X */
-						//break;
+						break;
 					}
 				}
 				





More information about the Bf-blender-cvs mailing list