Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. function Delaunay_index:findContainingTriangle(p)
  2.     local fh = self.mesh.face_hierarchy
  3.     local curr_face = 1
  4.     local face = fh[curr_face]
  5.     local contains, true_on
  6.     while face.children do
  7.         for _, ci in ipairs(face.children) do
  8.             local polygon = self:polygonizeFace(ci)
  9.             contained, true_on = vornmath.inside_polygon(polygon, p)
  10.             if contained then
  11.                 curr_face = ci
  12.                 face = fh[ci]
  13.                 break
  14.             end
  15.         end
  16.     end
  17.     return curr_face, true_on
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement