def inside(self) :
     p1 = self.get_center()
     p2 = Point(Box.grid.minx-1, p1.y, p1.z) # TODO: implement algo to find nearest border
     escaping_line = Line(p1, p2)
     cuts = 0
     box = self
     lines = set()
     while box.x != 0 :
         box = box.get_neighbour(-1, 0, 0)
         for line in box.lines :
             if line.id not in lines :
                 cut, d = escaping_line.get_intersection(line)
                 if cut is not None :
                     cuts += 1
                 lines.add(line.id)
     return cuts%2
Exemple #2
0
 def inside(self):
     p1 = self.get_center()
     p2 = Point(Box.grid.minx - 1, p1.y,
                p1.z)  # TODO: implement algo to find nearest border
     escaping_line = Line(p1, p2)
     cuts = 0
     box = self
     lines = set()
     while box.x != 0:
         box = box.get_neighbour(-1, 0, 0)
         for line in box.lines:
             if line.id not in lines:
                 cut, d = escaping_line.get_intersection(line)
                 if cut is not None:
                     cuts += 1
                 lines.add(line.id)
     return cuts % 2