Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-08-05 15:31:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-05 15:43:23 +0300
commite31a1c6fd3e1b53af9de4a3da2a234ea2331a35b (patch)
tree5a8b2e9bdc7109e51a57de8591862de5fa68210a /source/blender/blenlib
parentf9cf8151603dc3e3cad09e79027e8f4d89ee1ae7 (diff)
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/polyfill_2d.c5
1 files changed, 4 insertions, 1 deletions
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])