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.
This commit is contained in:
Campbell Barton 2019-08-05 22:31:42 +10:00
parent f9cf815160
commit e31a1c6fd3
Notes: blender-bot 2023-02-14 07:40:56 +01:00
Referenced by issue #67109, Broken rendering of mesh (ngon filling)
1 changed files with 4 additions and 1 deletions

View File

@ -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])