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 getSurroundingXIntersections( alreadyFilledSize, doubleSolidSurfaceThickness, surroundingSlices, y ): "Get x intersections from surrounding layers." if len( surroundingSlices ) < doubleSolidSurfaceThickness: return None joinedX = [] solidXIntersectionList = [] for surroundingIndex in range( len( surroundingSlices ) ): surroundingSlice = surroundingSlices[ surroundingIndex ] euclidean.addXIntersectionsFromLoops( surroundingSlice, surroundingIndex, joinedX, y ) solidTable = {} solid = False joinedX.sort( euclidean.compareSolidXByX ) for solidX in joinedX: solidXYInteger = int( solidX.imag ) euclidean.toggleHashtable( solidTable, solidXYInteger, "" ) oldSolid = solid solid = len( solidTable ) >= doubleSolidSurfaceThickness if oldSolid != solid: solidXIntersectionList.append( solidX.real ) return solidXIntersectionList
def getSurroundingXIntersections(alreadyFilledSize, doubleSolidSurfaceThickness, surroundingSlices, y): "Get x intersections from surrounding layers." if len(surroundingSlices) < doubleSolidSurfaceThickness: return None joinedX = [] solidXIntersectionList = [] for surroundingIndex in range(len(surroundingSlices)): surroundingSlice = surroundingSlices[surroundingIndex] euclidean.addXIntersectionsFromLoops(surroundingSlice, surroundingIndex, joinedX, y) solidTable = {} solid = False joinedX.sort(euclidean.compareSolidXByX) for solidX in joinedX: solidXYInteger = int(solidX.imag) euclidean.toggleHashtable(solidTable, solidXYInteger, "") oldSolid = solid solid = len(solidTable) >= doubleSolidSurfaceThickness if oldSolid != solid: solidXIntersectionList.append(solidX.real) return solidXIntersectionList