Yonaba / delaunay

Delaunay triangulation for convex polygon

Home Page:http://yonaba.github.io/delaunay/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lacks triangle

AntonioModer opened this issue · comments

commented

delaunaybug

Instead convex , we get a concave shape

commented

Ok then, i found resolve in this code: https://gist.github.com/AlliedEnvy/1009522

function CreateBoundingTriangle( vertices )
    -- NOTE: There's a bit of a heuristic here. If the bounding triangle 
    -- is too large and you see overflow/underflow errors. If it is too small 
    -- you end up with a non-convex hull.
...
    local dx = ( maxx - minx ) * 10
    local dy = ( maxy - miny ) * 10
...

Resolve:
Edit https://github.com/Yonaba/delaunay/blob/master/delaunay.lua#L383
to:

  -- the larger multiplier - the more convex shape is, and if not (or 1), then the figure will be concave
  local convexMultiplier = 1000  -- minimum = 1
  local dx, dy = (maxX - minX) * convexMultiplier, (maxY - minY) * convexMultiplier 

resolved