Пример #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
Пример #2
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)
Пример #3
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)
Пример #4
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