def getHorizontalSegments( fillLoops, alreadyFilledArounds, y ): "Get horizontal segments inside loops." solidXIntersectionList = [] euclidean.addXIntersectionsFromLoops( fillLoops, - 1, solidXIntersectionList, y ) for alreadyFilledAroundIndex in range( len( alreadyFilledArounds ) ): alreadyFilledLoops = alreadyFilledArounds[ alreadyFilledAroundIndex ] for alreadyFilledLoopIndex in range( len( alreadyFilledLoops ) ): alreadyFilledLoop = alreadyFilledLoops[ alreadyFilledLoopIndex ] euclidean.addXIntersections( alreadyFilledLoop, alreadyFilledAroundIndex, solidXIntersectionList, y ) return euclidean.getSegmentsFromIntersections( solidXIntersectionList, y, fillLoops[ 0 ][ 0 ].z )
def getHorizontalSegments(fillLoops, alreadyFilledArounds, y): "Get horizontal segments inside loops." solidXIntersectionList = [] euclidean.addXIntersectionsFromLoops(fillLoops, -1, solidXIntersectionList, y) for alreadyFilledAroundIndex in range(len(alreadyFilledArounds)): alreadyFilledLoops = alreadyFilledArounds[alreadyFilledAroundIndex] for alreadyFilledLoopIndex in range(len(alreadyFilledLoops)): alreadyFilledLoop = alreadyFilledLoops[alreadyFilledLoopIndex] euclidean.addXIntersections(alreadyFilledLoop, alreadyFilledAroundIndex, solidXIntersectionList, y) return euclidean.getSegmentsFromIntersections(solidXIntersectionList, y, fillLoops[0][0].z)
def getOverhangDirection( belowOutsetLoops, segmentBegin, segmentEnd ): "Add to span direction from the endpoint segments which overhang the layer below." segment = segmentEnd.minus( segmentBegin ) normalizedSegment = complex( segment.x, segment.y ) normalizedSegment /= abs( normalizedSegment ) segmentYMirror = complex( normalizedSegment.real, - normalizedSegment.imag ) segmentBegin = euclidean.getRoundZAxisByPlaneAngle( segmentYMirror, segmentBegin ) segmentEnd = euclidean.getRoundZAxisByPlaneAngle( segmentYMirror, segmentEnd ) solidXIntersectionList = [] y = segmentBegin.y solidXIntersectionList.append( complex( segmentBegin.x, - 1.0 ) ) solidXIntersectionList.append( complex( segmentEnd.x, - 1.0 ) ) for belowLoopIndex in range( len( belowOutsetLoops ) ): belowLoop = belowOutsetLoops[ belowLoopIndex ] rotatedOutset = euclidean.getPathRoundZAxisByPlaneAngle( segmentYMirror, belowLoop ) euclidean.addXIntersections( rotatedOutset, belowLoopIndex, solidXIntersectionList, y ) overhangingSegments = euclidean.getSegmentsFromIntersections( solidXIntersectionList, y, segmentBegin.z ) overhangDirection = complex() for overhangingSegment in overhangingSegments: overhangDirection += getDoubledRoundZ( overhangingSegment, normalizedSegment ) return overhangDirection