X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=blobdiff_plain;f=luamesh-polygon.lua;h=fd8a228aa3efdd9884cff4f9d7297a89a4dada7f;hp=2c14268ed8be8998dd310533e7aa1037e743ba5e;hb=HEAD;hpb=7bc85345ad42b4b24478accec113804862650422 diff --git a/luamesh-polygon.lua b/luamesh-polygon.lua index 2c14268..fd8a228 100644 --- a/luamesh-polygon.lua +++ b/luamesh-polygon.lua @@ -55,7 +55,13 @@ function doIntersect(p1,q1,p2,q2) end -- Returns true if the point p lies inside the polygon[] with n vertices -function isInside(listPoints,p) +function isInside(listPoints,p,h) + -- if the point is to close to a point of the polygon + for i=1,#listPoints do + if(math.sqrt(math.pow(p.x-listPoints[i].x,2) + math.pow(p.y-listPoints[i].y,2))<0.4*h) then + return false + end + end -- There must be at least 3 vertices in polygon[] if (#listPoints <= 3) then return false end -- Create a point for line segment from p to infinite