Beispiel #1
0
def getInfillDictionary(arounds,
                        aroundWidth,
                        infillInset,
                        infillWidth,
                        pixelTable,
                        rotatedLoops,
                        testLoops=None):
    'Get combined fill loops which include most of the points.'
    slightlyGreaterThanInfillInset = intercircle.globalIntercircleMultiplier * infillInset
    allPoints = intercircle.getPointsFromLoops(rotatedLoops, infillInset, 0.7)
    centers = intercircle.getCentersFromPoints(allPoints,
                                               slightlyGreaterThanInfillInset)
    infillDictionary = {}
    for center in centers:
        insetCenter = intercircle.getSimplifiedInsetFromClockwiseLoop(
            center, infillInset)
        insetPoint = insetCenter[0]
        if len(insetCenter) > 2 and intercircle.getIsLarge(
                insetCenter, infillInset) and euclidean.getIsInFilledRegion(
                    rotatedLoops, insetPoint):
            around = euclidean.getSimplifiedLoop(center, infillInset)
            euclidean.addLoopToPixelTable(around, pixelTable, aroundWidth)
            arounds.append(around)
            insetLoop = intercircle.getSimplifiedInsetFromClockwiseLoop(
                center, infillInset)
            euclidean.addXIntersectionsFromLoopForTable(
                insetLoop, infillDictionary, infillWidth)
            if testLoops != None:
                testLoops.append(insetLoop)
    return infillDictionary
Beispiel #2
0
def getInclusiveLoops(allPoints, corners, importRadius, isInteriorWanted=True):
    "Get loops which include most of the points."
    centers = intercircle.getCentersFromPoints(allPoints, importRadius)
    clockwiseLoops = []
    inclusiveLoops = []
    tinyRadius = 0.03 * importRadius
    for loop in centers:
        if len(loop) > 2:
            insetPoint = getInsetPoint(loop, tinyRadius)
            if getNumberOfOddIntersectionsFromLoops(insetPoint,
                                                    centers) % 4 == 0:
                inclusiveLoops.append(loop)
            else:
                clockwiseLoops.append(loop)
    pointTable = {}
    for inclusiveLoop in inclusiveLoops:
        addLoopToPointTable(inclusiveLoop, pointTable)
    if not isInteriorWanted:
        return getLoopsWithCorners(corners, importRadius, inclusiveLoops,
                                   pointTable)
    clockwiseLoops = getLoopsInOrderOfArea(compareAreaDescending,
                                           clockwiseLoops)
    for clockwiseLoop in clockwiseLoops:
        if getOverlapRatio(clockwiseLoop, pointTable) < 0.1:
            inclusiveLoops.append(clockwiseLoop)
            addLoopToPointTable(clockwiseLoop, pointTable)
    return getLoopsWithCorners(corners, importRadius, inclusiveLoops,
                               pointTable)
def getExtraFillLoops(loops, radius):
    'Get extra loops between inside and outside loops. Extra perimeters'
    greaterThanRadius = radius / 0.7853  #todo was  *1.4 ACT (radius /0.7853)  how much the tight spots are covered by the extra loops
    extraFillLoops = []
    centers = intercircle.getCentersFromPoints(intercircle.getPointsFromLoops(loops, greaterThanRadius), greaterThanRadius)
    for center in centers:
        inset = intercircle.getSimplifiedInsetFromClockwiseLoop(center, radius)
        if intercircle.isLargeSameDirection(inset, center, radius):
            if euclidean.getIsInFilledRegion(loops, euclidean.getLeftPoint(inset)):
                inset.reverse()
                extraFillLoops.append(inset)
    return extraFillLoops
Beispiel #4
0
def getDescendingAreaLoops(allPoints, corners, importRadius):
	'Get descending area loops which include most of the points.'
	loops = intercircle.getCentersFromPoints(allPoints, importRadius)
	descendingAreaLoops = []
	sortLoopsInOrderOfArea(True, loops)
	pointDictionary = {}
	for loop in loops:
		if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.3 and intercircle.getIsLarge(loop, importRadius):
			intercircle.directLoop(not euclidean.getIsInFilledRegion(descendingAreaLoops, loop[0]), loop)
			descendingAreaLoops.append(loop)
			addLoopToPointTable(loop, pointDictionary)
	descendingAreaLoops = euclidean.getSimplifiedLoops(descendingAreaLoops, importRadius)
	return getLoopsWithCorners(corners, importRadius, descendingAreaLoops, pointDictionary)
Beispiel #5
0
def getDescendingAreaLoops(allPoints, corners, importRadius):
	'Get loops which include most of the points.'
	loops = intercircle.getCentersFromPoints(allPoints, importRadius)
	descendingAreaLoops = []
	sortLoopsInOrderOfArea(True, loops)
	pointDictionary = {}
	for loop in loops:
		if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.1:
			intercircle.directLoop(not euclidean.getIsInFilledRegion(descendingAreaLoops, loop[0]), loop)
			descendingAreaLoops.append(loop)
			addLoopToPointTable(loop, pointDictionary)
	descendingAreaLoops = euclidean.getSimplifiedLoops(descendingAreaLoops, importRadius)
	return getLoopsWithCorners(corners, importRadius, descendingAreaLoops, pointDictionary)
def getExtraFillLoops(loops, radius):
    'Get extra loops between inside and outside loops. Extra perimeters'
    greaterThanRadius = radius / 0.7853  #todo was  *1.4 ACT (radius /0.7853)  how much the tight spots are covered by the extra loops
    extraFillLoops = []
    centers = intercircle.getCentersFromPoints(
        intercircle.getPointsFromLoops(loops, greaterThanRadius),
        greaterThanRadius)
    for center in centers:
        inset = intercircle.getSimplifiedInsetFromClockwiseLoop(center, radius)
        if intercircle.isLargeSameDirection(inset, center, radius):
            if euclidean.getIsInFilledRegion(loops,
                                             euclidean.getLeftPoint(inset)):
                inset.reverse()
                extraFillLoops.append(inset)
    return extraFillLoops
Beispiel #7
0
def getInfillDictionary(arounds, aroundWidth, infillInset, infillWidth, pixelTable, rotatedLoops, testLoops=None):
	'Get combined fill loops which include most of the points.'
	slightlyGreaterThanInfillInset = intercircle.globalIntercircleMultiplier * infillInset
	allPoints = intercircle.getPointsFromLoops(rotatedLoops, infillInset, 0.7)
	centers = intercircle.getCentersFromPoints(allPoints, slightlyGreaterThanInfillInset)
	infillDictionary = {}
	for center in centers:
		insetCenter = intercircle.getSimplifiedInsetFromClockwiseLoop(center, infillInset)
		insetPoint = insetCenter[0]
		if len(insetCenter) > 2 and intercircle.getIsLarge(insetCenter, infillInset) and euclidean.getIsInFilledRegion(rotatedLoops, insetPoint):
			around = euclidean.getSimplifiedLoop(center, infillInset)
			euclidean.addLoopToPixelTable(around, pixelTable, aroundWidth)
			arounds.append(around)
			insetLoop = intercircle.getSimplifiedInsetFromClockwiseLoop(center, infillInset)
			euclidean.addXIntersectionsFromLoopForTable(insetLoop, infillDictionary, infillWidth)
			if testLoops != None:
				testLoops.append(insetLoop)
	return infillDictionary
def getInclusiveLoops( allPoints, corners, importRadius, isInteriorWanted = True ):
	"Get loops which include most of the points."
	centers = intercircle.getCentersFromPoints( allPoints, importRadius )
	clockwiseLoops = []
	inclusiveLoops = []
	tinyRadius = 0.03 * importRadius
	for loop in centers:
		if len( loop ) > 2:
			insetPoint = getInsetPoint( loop, tinyRadius )
			if getNumberOfOddIntersectionsFromLoops( insetPoint, centers ) % 4 == 0:
				inclusiveLoops.append( loop )
			else:
				clockwiseLoops.append( loop )
	pointTable = {}
	for inclusiveLoop in inclusiveLoops:
		addLoopToPointTable( inclusiveLoop, pointTable )
	if not isInteriorWanted:
		return getLoopsWithCorners( corners, importRadius, inclusiveLoops, pointTable )
	clockwiseLoops = getLoopsInOrderOfArea( compareAreaDescending, clockwiseLoops )
	for clockwiseLoop in clockwiseLoops:
		if getOverlapRatio( clockwiseLoop, pointTable ) < 0.1:
			inclusiveLoops.append( clockwiseLoop )
			addLoopToPointTable( clockwiseLoop, pointTable )
	return getLoopsWithCorners( corners, importRadius, inclusiveLoops, pointTable )