[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49564] trunk/blender/source/blender/ blenlib/intern/math_geom.c: fix a glitch where overlapping feathering could give random bad pixels, this was caused by feather edge going in a different direction to the mask edge - creating bowtie quads .

Campbell Barton ideasman42 at gmail.com
Sat Aug 4 23:04:27 CEST 2012


Revision: 49564
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49564
Author:   campbellbarton
Date:     2012-08-04 21:04:26 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
fix a glitch where overlapping feathering could give random bad pixels, this was caused by feather edge going in a different direction to the mask edge - creating bowtie quads. 

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

Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c	2012-08-04 20:25:04 UTC (rev 49563)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c	2012-08-04 21:04:26 UTC (rev 49564)
@@ -1991,8 +1991,13 @@
 void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2],
                                  const float co[2], float w[4])
 {
-#define MEAN_VALUE_HALF_TAN_V2(_area, i1, i2) ((_area = cross_v2v2(dirs[i1], dirs[i2])) != 0.0f ? \
-	                                           (((lens[i1] * lens[i2]) - dot_v2v2(dirs[i1], dirs[i2])) / _area) : 0.0f)
+	/* note: fabsf() here is not needed for convex quads (and not used in interp_weights_poly_v2).
+	 *       but in the case of concave/bowtie quads for the mask rasterizer it gives unreliable results
+	 *       without adding absf(). If this becomes an issue for more general useage we could have
+	 *       this optional or use a different function - Campbell */
+#define MEAN_VALUE_HALF_TAN_V2(_area, i1, i2) \
+	        ((_area = cross_v2v2(dirs[i1], dirs[i2])) != 0.0f ? \
+	         fabsf(((lens[i1] * lens[i2]) - dot_v2v2(dirs[i1], dirs[i2])) / _area) : 0.0f)
 
 	float wtot, area;
 




More information about the Bf-blender-cvs mailing list