def isOverlappingAnother( self, anotherBoundingLoop ): 'Determine if this bounding loop is intersecting another bounding loop.' if self.isRectangleMissingAnother( anotherBoundingLoop ): return False for point in self.loop: if euclidean.getNumberOfIntersectionsToLeft( anotherBoundingLoop.loop, point ) % 2 == 1: return True for point in anotherBoundingLoop.loop: if euclidean.getNumberOfIntersectionsToLeft( self.loop, point ) % 2 == 1: return True return isLoopIntersectingLoop( anotherBoundingLoop.loop, self.loop ) #later check for intersection on only acute angles
def getIsIntersectingWithinList(loop, loopList): "Determine if the loop is intersecting or is within the loop list." leftPoint = euclidean.getLeftPoint(loop) for otherLoop in loopList: if euclidean.getNumberOfIntersectionsToLeft(otherLoop, leftPoint) % 2 == 1: return True return euclidean.isLoopIntersectingLoops(loop, loopList)
def getNumberOfOddIntersectionsFromLoops(leftPoint, loops): "Get the number of odd intersections with the loops." totalNumberOfOddIntersections = 0 for loop in loops: totalNumberOfOddIntersections += int( euclidean.getNumberOfIntersectionsToLeft(loop, leftPoint) % 2) return totalNumberOfOddIntersections
def isEntirelyInsideAnother( self, anotherBoundingLoop ): 'Determine if this bounding loop is entirely inside another bounding loop.' if self.minimum.imag < anotherBoundingLoop.minimum.imag or self.minimum.real < anotherBoundingLoop.minimum.real: return False if self.maximum.imag > anotherBoundingLoop.maximum.imag or self.maximum.real > anotherBoundingLoop.maximum.real: return False for point in self.loop: if euclidean.getNumberOfIntersectionsToLeft( anotherBoundingLoop.loop, point ) % 2 == 0: return False return not isLoopIntersectingLoop( anotherBoundingLoop.loop, self.loop ) #later check for intersection on only acute angles
def getNumberOfOddIntersectionsFromLoops( leftPoint, loops ): "Get the number of odd intersections with the loops." totalNumberOfOddIntersections = 0 for loop in loops: totalNumberOfOddIntersections += int( euclidean.getNumberOfIntersectionsToLeft( loop, leftPoint ) % 2 ) return totalNumberOfOddIntersections