[Bf-blender-cvs] [e31a1c6fd3e] master: Fix T67109: n-gon tessellation error with co-linear edges

Campbell Barton noreply at git.blender.org
Mon Aug 5 14:45:47 CEST 2019


Commit: e31a1c6fd3e1b53af9de4a3da2a234ea2331a35b
Author: Campbell Barton
Date:   Mon Aug 5 22:31:42 2019 +1000
Branches: master
https://developer.blender.org/rBe31a1c6fd3e1b53af9de4a3da2a234ea2331a35b

Fix T67109: n-gon tessellation error with co-linear edges

Improve the area calculation method for better precision,
so faces offset from the center don't have a less precise area.

===================================================================

M	source/blender/blenlib/intern/polyfill_2d.c

===================================================================

diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c
index 575a4a06d6a..31b18079c73 100644
--- a/source/blender/blenlib/intern/polyfill_2d.c
+++ b/source/blender/blenlib/intern/polyfill_2d.c
@@ -193,7 +193,10 @@ BLI_INLINE eSign signum_enum(float a)
  */
 BLI_INLINE float area_tri_signed_v2_alt_2x(const float v1[2], const float v2[2], const float v3[2])
 {
-  return ((v1[0] * (v2[1] - v3[1])) + (v2[0] * (v3[1] - v1[1])) + (v3[0] * (v1[1] - v2[1])));
+  float d2[2], d3[2];
+  sub_v2_v2v2(d2, v2, v1);
+  sub_v2_v2v2(d3, v3, v1);
+  return (d2[0] * d3[1]) - (d3[0] * d2[1]);
 }
 
 static eSign span_tri_v2_sign(const float v1[2], const float v2[2], const float v3[2])



More information about the Bf-blender-cvs mailing list