示例#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)
示例#2
0
文件: teardrop.py 项目: folksjos/RepG
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)
示例#3
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get path with overhangs removed or filled in."
    if len(loop) < 3:
        print(
            'Warning, loop has less than three sides in getManipulatedPaths in overhang for:'
        )
        print(xmlElement)
        return [loop]
    overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi -
                                                           overhangAngle)
    overhangVerticalAngle = math.radians(
        evaluate.getEvaluatedFloatDefault(0.0, prefix + 'inclination',
                                          xmlElement))
    if overhangVerticalAngle != 0.0:
        overhangVerticalCosine = abs(math.cos(overhangVerticalAngle))
        if overhangVerticalCosine == 0.0:
            return [loop]
        imaginaryTimesCosine = overhangPlaneAngle.imag * overhangVerticalCosine
        overhangPlaneAngle = euclidean.getNormalized(
            complex(overhangPlaneAngle.real, imaginaryTimesCosine))
    alongAway = AlongAway(loop, overhangPlaneAngle)
    if euclidean.getIsWiddershinsByVector3(loop):
        alterWiddershinsSupportedPath(alongAway, close)
    else:
        alterClockwiseSupportedPath(alongAway, xmlElement)
    return [
        euclidean.getLoopWithoutCloseSequentialPoints(close, alongAway.loop)
    ]
示例#4
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get path with overhangs removed or filled in."
	if len(loop) < 3:
		print('Warning, loop has less than three sides in getManipulatedPaths in overhang for:')
		print(xmlElement)
		return [loop]
	overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar( 0.5 * math.pi - overhangAngle )
	overhangVerticalAngle = math.radians( evaluate.getEvaluatedFloatDefault(0.0,  prefix + 'inclination', xmlElement ) )
	if overhangVerticalAngle != 0.0:
		overhangVerticalCosine = abs( math.cos( overhangVerticalAngle ) )
		if overhangVerticalCosine == 0.0:
			return [loop]
		imaginaryTimesCosine = overhangPlaneAngle.imag * overhangVerticalCosine
		overhangPlaneAngle = euclidean.getNormalized( complex( overhangPlaneAngle.real, imaginaryTimesCosine ) )
	alongAway = AlongAway( loop, overhangPlaneAngle )
	if euclidean.getIsWiddershinsByVector3(loop):
		alterWiddershinsSupportedPath( alongAway, close )
	else:
		alterClockwiseSupportedPath( alongAway, xmlElement )
	return [ euclidean.getLoopWithoutCloseSequentialPoints( close,  alongAway.loop ) ]