def isLineIntersectingLoop(loop, pointBegin, pointEnd):
 normalizedSegment = (pointEnd - pointBegin)
 normalizedSegmentLength = abs(normalizedSegment)
 if (normalizedSegmentLength > 0.0):
  normalizedSegment /= normalizedSegmentLength
  segmentYMirror = complex(normalizedSegment.real, (- normalizedSegment.imag))
  pointBeginRotated = (segmentYMirror * pointBegin)
  pointEndRotated = (segmentYMirror * pointEnd)
  if isLoopIntersectingInsideXSegment(loop, pointBeginRotated.real, pointEndRotated.real, segmentYMirror, pointBeginRotated.imag):
   return True
 return False

def isLineIntersectingLoop ( loop , pointBegin , pointEnd ) : normalizedSegment = ( pointEnd - pointBegin ) normalizedSegmentLength = abs ( normalizedSegment ) if ( normalizedSegmentLength > 0.0 ) : normalizedSegment /= normalizedSegmentLength segmentYMirror = complex ( normalizedSegment . real , ( - normalizedSegment . imag ) ) pointBeginRotated = ( segmentYMirror * pointBegin ) pointEndRotated = ( segmentYMirror * pointEnd ) if isLoopIntersectingInsideXSegment ( loop , pointBeginRotated . real , pointEndRotated . real , segmentYMirror , pointBeginRotated . imag ) : return True return False
determine if the line is intersecting loops .