polygon

Polygon triangulation
git clone git://git.meso-star.fr/polygon.git
Log | Files | Refs | README | LICENSE

commit 7d26600da727859c243288f93b9096020c09b710
parent b945d6f179d4a9177f12ff3cef0609e184818476
Author: vaplv <vaplv@free.fr>
Date:   Wed, 26 Apr 2017 14:29:43 +0200

Fix issues with aligned vertices

If vertices were aligned the triangulation process might fail since
aligned vertices were handled as concave vertices.

Diffstat:
Msrc/polygon.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/polygon.c b/src/polygon.c @@ -178,7 +178,7 @@ node_is_an_ear float Q[3], v; f3_cross(Q, T, E1); v = f3_dot(Q, normal) / det; - if( v >= 0.f && v <= 1.f && (u + v) <= 1.f) + if(v >= 0.f && v <= 1.f && (u + v) <= 1.f) return 0; } } @@ -388,7 +388,7 @@ polygon_triangulate FOR_EACH(inode, 0, poly->nvertices) { /* Find the list of concave vertices */ node_normal_compute(poly, inode, normal); - if(f3_dot(normal_convex, normal) <= 0.f) { + if(f3_dot(normal_convex, normal) < 0.f) { const char dummy = 1; res = htable_u32_set(&poly->vertices_concave, &inode, &dummy); if(res != RES_OK)