Skip to main content
. 2022 Sep 17;22(18):7036. doi: 10.3390/s22187036
Algorithm 1 Edge acquisition in quads intersecting with line
Input: root,p,q
Output: edgeSet
1: function LineIntersectPoly(p,q)
2:  GetEdges(node,p,q,edgeSet)
3: for i = 1 to N  //N is the number of edges in edgeSet
4:   If edgeSet[i]   (p,q) then return true
5: end for
6: return false
7: end function
8: function GetEdges(node,p,q,edgeSet)
9: if node.child and node.edges then
10:   edgeSet.append(node.edges)
11: else
12:   child = {NE, NW, SE, SW}
13:   for i = 1:4 do
14:    if node.child[i].bound   (p,q) then
15:     GetEdges(node.child[i],p,q,edgeSet)
16:     end if
17:    end for
18: end if
19: end function