Example #1
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)
Example #2
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 )