Example #1
0
def addAlreadyFilledArounds( alreadyFilledArounds, loop, radius ):
	"Add already filled loops around loop to alreadyFilledArounds."
	radius = abs( radius )
	alreadyFilledLoop = []
	slightlyGreaterThanRadius = 1.01 * radius
	muchGreaterThanRadius = 2.5 * radius
	centers = intercircle.getCentersFromLoop( loop, slightlyGreaterThanRadius )
	for center in centers:
		alreadyFilledInset = intercircle.getSimplifiedInsetFromClockwiseLoop( center, radius )
		if intercircle.isLargeSameDirection( alreadyFilledInset, center, radius ):
			alreadyFilledLoop.append( alreadyFilledInset )
	if len( alreadyFilledLoop ) > 0:
		alreadyFilledArounds.append( alreadyFilledLoop )
Example #2
0
def getBridgeLoops( layerThickness, loop ):
	"Get the inset bridge loops from the loop."
	halfWidth = 1.5 * layerThickness
	slightlyGreaterThanHalfWidth = 1.1 * halfWidth
	extrudateLoops = []
	centers = intercircle.getCentersFromLoop( loop, slightlyGreaterThanHalfWidth )
	for center in centers:
		extrudateLoop = intercircle.getSimplifiedInsetFromClockwiseLoop( center, halfWidth )
		if intercircle.isLargeSameDirection( extrudateLoop, center, halfWidth ):
			if euclidean.isPathInsideLoop( loop, extrudateLoop ) == euclidean.isWiddershins( loop ):
				extrudateLoop.reverse()
				extrudateLoops.append( extrudateLoop )
	return extrudateLoops
Example #3
0
def addAlreadyFilledArounds( alreadyFilledArounds, loop, radius ):
	"Add already filled loops around loop to alreadyFilledArounds."
	radius = abs( radius )
	alreadyFilledLoop = []
	slightlyGreaterThanRadius = 1.01 * radius
	muchGreaterThanRadius = 2.5 * radius
	circleNodes = intercircle.getCircleNodesFromLoop( loop, slightlyGreaterThanRadius )
	centers = intercircle.getCentersFromCircleNodes( circleNodes )
	for center in centers:
		alreadyFilledInset = intercircle.getSimplifiedInsetFromClockwiseLoop( center, radius )
		if euclidean.isLarge( alreadyFilledInset, muchGreaterThanRadius ) or euclidean.isWiddershins( alreadyFilledInset ):
			alreadyFilledLoop.append( alreadyFilledInset )
	if len( alreadyFilledLoop ) > 0:
		alreadyFilledArounds.append( alreadyFilledLoop )
Example #4
0
def addAlreadyFilledArounds(alreadyFilledArounds, loop, radius):
    "Add already filled loops around loop to alreadyFilledArounds."
    radius = abs(radius)
    alreadyFilledLoop = []
    slightlyGreaterThanRadius = 1.01 * radius
    muchGreaterThanRadius = 2.5 * radius
    circleNodes = intercircle.getCircleNodesFromLoop(
        loop, slightlyGreaterThanRadius)
    centers = intercircle.getCentersFromCircleNodes(circleNodes)
    for center in centers:
        alreadyFilledInset = intercircle.getSimplifiedInsetFromClockwiseLoop(
            center, radius)
        if euclidean.isLarge(alreadyFilledInset, muchGreaterThanRadius
                             ) or euclidean.isWiddershins(alreadyFilledInset):
            alreadyFilledLoop.append(alreadyFilledInset)
    if len(alreadyFilledLoop) > 0:
        alreadyFilledArounds.append(alreadyFilledLoop)
Example #5
0
	def getBetweens( self ):
		"Set betweens for the layer."
		if self.layerZ in self.betweenTable:
			return self.betweenTable[ self.layerZ ]
		if self.layerZ not in self.layerTable:
			return []
		halfFillInset = 0.5 * self.fillInset
		betweens = []
		for boundaryLoop in self.layerTable[ self.layerZ ]:
			circleNodes = intercircle.getCircleNodesFromLoop( boundaryLoop, self.fillInset )
			centers = intercircle.getCentersFromCircleNodes( circleNodes )
			for center in centers:
				inset = intercircle.getSimplifiedInsetFromClockwiseLoop( center, halfFillInset )
				if euclidean.isLargeSameDirection( inset, center, self.fillInset ):
					if euclidean.isPathInsideLoop( boundaryLoop, inset ) == euclidean.isWiddershins( boundaryLoop ):
						betweens.append( inset )
		self.betweenTable[ self.layerZ ] = betweens
		return betweens
Example #6
0
 def getBetweens(self):
     "Set betweens for the layer."
     if self.layerZ in self.betweenTable:
         return self.betweenTable[self.layerZ]
     if self.layerZ not in self.layerTable:
         return []
     halfFillInset = 0.5 * self.fillInset
     betweens = []
     for boundaryLoop in self.layerTable[self.layerZ]:
         circleNodes = intercircle.getCircleNodesFromLoop(
             boundaryLoop, self.fillInset)
         centers = intercircle.getCentersFromCircleNodes(circleNodes)
         for center in centers:
             inset = intercircle.getSimplifiedInsetFromClockwiseLoop(
                 center, halfFillInset)
             if euclidean.isLargeSameDirection(inset, center,
                                               self.fillInset):
                 if euclidean.isPathInsideLoop(
                         boundaryLoop,
                         inset) == euclidean.isWiddershins(boundaryLoop):
                     betweens.append(inset)
     self.betweenTable[self.layerZ] = betweens
     return betweens
Example #7
0
def getBridgeDirection( belowLoops, layerLoops, layerThickness ):
	"Get span direction for the majority of the overhanging extrusion perimeter, if any."
	if len( belowLoops ) < 1:
		return None
	belowOutsetLoops = []
	overhangInset = 1.875 * layerThickness
	slightlyGreaterThanOverhang = 1.1 * overhangInset
	for loop in belowLoops:
		centers = intercircle.getCentersFromLoopDirection( True, loop, slightlyGreaterThanOverhang )
		for center in centers:
			outset = intercircle.getSimplifiedInsetFromClockwiseLoop( center, overhangInset )
			if intercircle.isLargeSameDirection( outset, center, overhangInset ):
				belowOutsetLoops.append( outset )
	bridgeRotation = complex()
	for loop in layerLoops:
		for pointIndex in xrange( len( loop ) ):
			previousIndex = ( pointIndex + len( loop ) - 1 ) % len( loop )
			bridgeRotation += getOverhangDirection( belowOutsetLoops, loop[ previousIndex ], loop[ pointIndex ] )
	if abs( bridgeRotation ) < 0.75 * layerThickness:
		return None
	else:
		bridgeRotation /= abs( bridgeRotation )
		return cmath.sqrt( bridgeRotation )