mirror of
https://github.com/vrld/HC.git
synced 2024-11-18 12:54:23 +00:00
ensure triangulated vertices are not collinear
This commit is contained in:
parent
410cf048e2
commit
47d64e42cf
@ -319,7 +319,7 @@ function Polygon:triangulate()
|
||||
while n_vert > 3 do
|
||||
next, prev = next_idx[current], prev_idx[current]
|
||||
local p,q,r = vertices[prev], vertices[current], vertices[next]
|
||||
if isEar(p,q,r, concave) then
|
||||
if isEar(p,q,r, concave) and not areCollinear(p, q, r) then
|
||||
triangles[#triangles+1] = newPolygon(p.x,p.y, q.x,q.y, r.x,r.y)
|
||||
next_idx[prev], prev_idx[next] = next, prev
|
||||
concave[q] = nil
|
||||
|
Loading…
Reference in New Issue
Block a user