def getOverhangDirection(belowOutsetLoops, segmentBegin, segmentEnd):
 segment = (segmentEnd - segmentBegin)
 normalizedSegment = euclidean.getNormalized(complex(segment.real, segment.imag))
 segmentYMirror = complex(normalizedSegment.real, (- normalizedSegment.imag))
 segmentBegin = (segmentYMirror * segmentBegin)
 segmentEnd = (segmentYMirror * segmentEnd)
 solidXIntersectionList = []
 y = segmentBegin.imag
 solidXIntersectionList.append(euclidean.XIntersectionIndex((-1.0), segmentBegin.real))
 solidXIntersectionList.append(euclidean.XIntersectionIndex((-1.0), segmentEnd.real))
 for belowLoopIndex in xrange(len(belowOutsetLoops)):
  belowLoop = belowOutsetLoops[belowLoopIndex]
  rotatedOutset = euclidean.getPointsRoundZAxis(segmentYMirror, belowLoop)
  euclidean.addXIntersectionIndexesFromLoopY(rotatedOutset, belowLoopIndex, solidXIntersectionList, y)
 overhangingSegments = euclidean.getSegmentsFromXIntersectionIndexes(solidXIntersectionList, y)
 overhangDirection = complex()
 for overhangingSegment in overhangingSegments:
  overhangDirection += getDoubledRoundZ(overhangingSegment, normalizedSegment)
 return overhangDirection

def getOverhangDirection ( belowOutsetLoops , segmentBegin , segmentEnd ) : segment = ( segmentEnd - segmentBegin ) normalizedSegment = euclidean . getNormalized ( complex ( segment . real , segment . imag ) ) segmentYMirror = complex ( normalizedSegment . real , ( - normalizedSegment . imag ) ) segmentBegin = ( segmentYMirror * segmentBegin ) segmentEnd = ( segmentYMirror * segmentEnd ) solidXIntersectionList = [ ] y = segmentBegin . imag solidXIntersectionList . append ( euclidean . XIntersectionIndex ( ( - 1.0 ) , segmentBegin . real ) ) solidXIntersectionList . append ( euclidean . XIntersectionIndex ( ( - 1.0 ) , segmentEnd . real ) ) for belowLoopIndex in xrange ( len ( belowOutsetLoops ) ) : belowLoop = belowOutsetLoops [ belowLoopIndex ] rotatedOutset = euclidean . getPointsRoundZAxis ( segmentYMirror , belowLoop ) euclidean . addXIntersectionIndexesFromLoopY ( rotatedOutset , belowLoopIndex , solidXIntersectionList , y ) overhangingSegments = euclidean . getSegmentsFromXIntersectionIndexes ( solidXIntersectionList , y ) overhangDirection = complex ( ) for overhangingSegment in overhangingSegments : overhangDirection += getDoubledRoundZ ( overhangingSegment , normalizedSegment ) return overhangDirection
add to span direction from the endpoint segments which overhang the layer below .