def isLoopIntersectingInsideXSegment(loop, segmentFirstX, segmentSecondX, segmentYMirror, y):
 rotatedLoop = getPointsRoundZAxis(segmentYMirror, loop)
 for pointIndex in xrange(len(rotatedLoop)):
  pointFirst = rotatedLoop[pointIndex]
  pointSecond = rotatedLoop[((pointIndex + 1) % len(rotatedLoop))]
  if isLineIntersectingInsideXSegment(pointFirst, pointSecond, segmentFirstX, segmentSecondX, y):
   return True
 return False

def isLoopIntersectingInsideXSegment ( loop , segmentFirstX , segmentSecondX , segmentYMirror , y ) : rotatedLoop = getPointsRoundZAxis ( segmentYMirror , loop ) for pointIndex in xrange ( len ( rotatedLoop ) ) : pointFirst = rotatedLoop [ pointIndex ] pointSecond = rotatedLoop [ ( ( pointIndex + 1 ) % len ( rotatedLoop ) ) ] if isLineIntersectingInsideXSegment ( pointFirst , pointSecond , segmentFirstX , segmentSecondX , y ) : return True return False
determine if the loop is intersecting inside the x segment .