Esempio n. 1
0
def getTeardropPath(inclination, radius, xmlElement):
    "Get vector3 teardrop path."
    teardropSides = evaluate.getSidesMinimumThreeBasedOnPrecision(
        radius, xmlElement)
    sideAngle = 2.0 * math.pi / float(teardropSides)
    overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(overhangAngle)
    overhangAngle = math.atan2(overhangPlaneAngle.imag,
                               overhangPlaneAngle.real * math.cos(inclination))
    tanOverhangAngle = math.tan(overhangAngle)
    beginAngle = overhangAngle
    beginMinusEndAngle = math.pi + overhangAngle + overhangAngle
    withinSides = int(math.ceil(beginMinusEndAngle / sideAngle))
    withinSideAngle = -beginMinusEndAngle / float(withinSides)
    teardropPath = []
    for side in xrange(withinSides + 1):
        unitPolar = euclidean.getWiddershinsUnitPolar(beginAngle)
        teardropPath.append(unitPolar * radius)
        beginAngle += withinSideAngle
    firstPoint = teardropPath[0]
    overhangSpan = evaluate.getOverhangSpan(xmlElement)
    if overhangSpan <= 0.0:
        teardropPath.append(
            complex(0.0, firstPoint.imag + firstPoint.real / tanOverhangAngle))
    else:
        deltaX = (radius - firstPoint.imag) * tanOverhangAngle
        overhangPoint = complex(firstPoint.real - deltaX, radius)
        remainingDeltaX = max(0.0, overhangPoint.real - 0.5 * overhangSpan)
        overhangPoint += complex(-remainingDeltaX,
                                 remainingDeltaX / tanOverhangAngle)
        teardropPath.append(complex(-overhangPoint.real, overhangPoint.imag))
        teardropPath.append(overhangPoint)
    return euclidean.getVector3Path(teardropPath)
Esempio n. 2
0
def alterClockwiseSupportedPath( alongAway, xmlElement ):
	"Get clockwise path with overhangs carved out."
	alongAway.bottomPoints = []
	alongAway.overhangSpan = evaluate.getOverhangSpan(xmlElement)
	maximumY = - 987654321.0
	minimumYPointIndex = 0
	for pointIndex in xrange( len( alongAway.loop ) ):
		point = alongAway.loop[pointIndex]
		if point.y < alongAway.loop[ minimumYPointIndex ].y:
			minimumYPointIndex = pointIndex
		maximumY = max( maximumY, point.y )
	alongAway.maximumYPlus = 2.0 * ( maximumY - alongAway.loop[ minimumYPointIndex ].y )
	alongAway.loop = euclidean.getAroundLoop( minimumYPointIndex, minimumYPointIndex, alongAway.loop )
	overhangClockwise = OverhangClockwise( alongAway )
	alongAway.unsupportedPointIndexes = []
	oldUnsupportedPointIndexesLength = - 987654321.0
	while len( alongAway.unsupportedPointIndexes ) > oldUnsupportedPointIndexesLength:
		oldUnsupportedPointIndexesLength = len( alongAway.unsupportedPointIndexes )
		addUnsupportedPointIndexes( alongAway )
	for pointIndex in alongAway.unsupportedPointIndexes:
		point = alongAway.loop[pointIndex]
		point.y -= alongAway.maximumYPlus
	alongAway.unsupportedPointIndexes.sort()
	alongAway.unsupportedPointIndexLists = []
	oldUnsupportedPointIndex = - 987654321.0
	unsupportedPointIndexList = None
	for unsupportedPointIndex in alongAway.unsupportedPointIndexes:
		if unsupportedPointIndex > oldUnsupportedPointIndex + 1:
			unsupportedPointIndexList = []
			alongAway.unsupportedPointIndexLists.append( unsupportedPointIndexList )
		oldUnsupportedPointIndex = unsupportedPointIndex
		unsupportedPointIndexList.append( unsupportedPointIndex )
	alongAway.unsupportedPointIndexLists.reverse()
	for unsupportedPointIndexList in alongAway.unsupportedPointIndexLists:
		overhangClockwise.alterLoop( unsupportedPointIndexList )
Esempio n. 3
0
def getTeardropPath(inclination, radius, xmlElement):
	"Get vector3 teardrop path."
	teardropSides = evaluate.getSidesMinimumThreeBasedOnPrecision(radius, xmlElement)
	sideAngle = 2.0 * math.pi / float(teardropSides)
	overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(overhangAngle)
	overhangAngle = math.atan2(overhangPlaneAngle.imag, overhangPlaneAngle.real * math.cos(inclination))
	tanOverhangAngle = math.tan(overhangAngle)
	beginAngle = overhangAngle
	beginMinusEndAngle = math.pi + overhangAngle + overhangAngle
	withinSides = int(math.ceil(beginMinusEndAngle / sideAngle))
	withinSideAngle = -beginMinusEndAngle / float(withinSides)
	teardropPath = []
	for side in xrange(withinSides + 1):
		unitPolar = euclidean.getWiddershinsUnitPolar(beginAngle)
		teardropPath.append(unitPolar * radius)
		beginAngle += withinSideAngle
	firstPoint = teardropPath[0]
	overhangSpan = evaluate.getOverhangSpan(xmlElement)
	if overhangSpan <= 0.0:
		teardropPath.append(complex(0.0, firstPoint.imag + firstPoint.real / tanOverhangAngle))
	else:
		deltaX = (radius - firstPoint.imag) * tanOverhangAngle
		overhangPoint = complex(firstPoint.real - deltaX, radius)
		remainingDeltaX = max(0.0, overhangPoint.real - 0.5 * overhangSpan )
		overhangPoint += complex(-remainingDeltaX, remainingDeltaX / tanOverhangAngle)
		teardropPath.append(complex(-overhangPoint.real, overhangPoint.imag))
		teardropPath.append(overhangPoint)
	return euclidean.getVector3Path(teardropPath)
Esempio n. 4
0
def alterClockwiseSupportedPath( alongAway, xmlElement ):
	"Get clockwise path with overhangs carved out."
	alongAway.bottomPoints = []
	alongAway.overhangSpan = evaluate.getOverhangSpan(xmlElement)
	maximumY = - 987654321.0
	minimumYPointIndex = 0
	for pointIndex in xrange( len( alongAway.loop ) ):
		point = alongAway.loop[pointIndex]
		if point.y < alongAway.loop[ minimumYPointIndex ].y:
			minimumYPointIndex = pointIndex
		maximumY = max( maximumY, point.y )
	alongAway.maximumYPlus = 2.0 * ( maximumY - alongAway.loop[ minimumYPointIndex ].y )
	alongAway.loop = euclidean.getAroundLoop( minimumYPointIndex, minimumYPointIndex, alongAway.loop )
	overhangClockwise = OverhangClockwise( alongAway )
	alongAway.unsupportedPointIndexes = []
	oldUnsupportedPointIndexesLength = - 987654321.0
	while len( alongAway.unsupportedPointIndexes ) > oldUnsupportedPointIndexesLength:
		oldUnsupportedPointIndexesLength = len( alongAway.unsupportedPointIndexes )
		addUnsupportedPointIndexes( alongAway )
	for pointIndex in alongAway.unsupportedPointIndexes:
		point = alongAway.loop[pointIndex]
		point.y -= alongAway.maximumYPlus
	alongAway.unsupportedPointIndexes.sort()
	alongAway.unsupportedPointIndexLists = []
	oldUnsupportedPointIndex = - 987654321.0
	unsupportedPointIndexList = None
	for unsupportedPointIndex in alongAway.unsupportedPointIndexes:
		if unsupportedPointIndex > oldUnsupportedPointIndex + 1:
			unsupportedPointIndexList = []
			alongAway.unsupportedPointIndexLists.append( unsupportedPointIndexList )
		oldUnsupportedPointIndex = unsupportedPointIndex
		unsupportedPointIndexList.append( unsupportedPointIndex )
	alongAway.unsupportedPointIndexLists.reverse()
	for unsupportedPointIndexList in alongAway.unsupportedPointIndexLists:
		overhangClockwise.alterLoop( unsupportedPointIndexList )