예제 #1
0
def getTeardropPath(inclination, radius, xmlElement):
	"Get vector3 teardrop path."
	teardropSides = evaluate.getSidesMinimumThreeBasedOnPrecision(radius, xmlElement)
	sideAngle = 2.0 * math.pi / float(teardropSides)
	overhangRadians = setting.getOverhangRadians(xmlElement)
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(overhangRadians)
	overhangRadians = math.atan2(overhangPlaneAngle.imag, overhangPlaneAngle.real * math.cos(inclination))
	tanOverhangAngle = math.tan(overhangRadians)
	beginAngle = overhangRadians
	beginMinusEndAngle = math.pi + overhangRadians + overhangRadians
	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 = setting.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
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]
    overhangRadians = setting.getOverhangRadians(xmlElement)
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi -
                                                           overhangRadians)
    overhangVerticalRadians = math.radians(
        evaluate.getEvaluatedFloat(0.0, prefix + 'inclination', xmlElement))
    if overhangVerticalRadians != 0.0:
        overhangVerticalCosine = abs(math.cos(overhangVerticalRadians))
        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)
    ]
예제 #3
0
def getTeardropPathByEndStart(elementNode, end, radius, start):
    "Get vector3 teardrop path by end and start."
    inclination = getInclination(end, start)
    sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
        elementNode, radius)
    radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
        elementNoderadius, sides)
    return getTeardropPath(
        inclination, setting.getOverhangRadians(elementNode),
        setting.getOverhangSpan(elementNode), radiusArealized, sides)
예제 #4
0
def getTeardropPathByEndStart(elementNode, end, radius, start):
    "Get vector3 teardrop path by end and start."
    inclination = getInclination(end, start)
    sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
        elementNode, radius)
    radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
        elementNoderadius, sides)
    return getTeardropPath(inclination,
                           setting.getOverhangRadians(elementNode),
                           setting.getOverhangSpan(elementNode),
                           radiusArealized, sides)
예제 #5
0
	def __init__(self, elementNode):
		'Set defaults.'
		end = evaluate.getVector3ByPrefix(None, elementNode, 'end')
		start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		inclinationDegree = math.degrees(getInclination(end, start))
		self.elementNode = elementNode
		self.inclination = math.radians(evaluate.getEvaluatedFloat(inclinationDegree, elementNode, 'inclination'))
		self.overhangRadians = setting.getOverhangRadians(elementNode)
		self.overhangSpan = setting.getOverhangSpan(elementNode)
		self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, 'radius', 'diameter', 1.0)
		size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
		if size != None:
			self.radius = 0.5 * size
		self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
		if self.sides == None:
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, self.radius)
		self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(elementNode, self.radius, self.sides)
예제 #6
0
파일: overhang.py 프로젝트: Sciumo/SFACT
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]
	overhangRadians = setting.getOverhangRadians(xmlElement)
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi - overhangRadians)
	overhangVerticalRadians = math.radians(evaluate.getEvaluatedFloat(0.0,  prefix + 'inclination', xmlElement))
	if overhangVerticalRadians != 0.0:
		overhangVerticalCosine = abs(math.cos(overhangVerticalRadians))
		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)]
예제 #7
0
 def __init__(self, elementNode):
     'Set defaults.'
     end = evaluate.getVector3ByPrefix(None, elementNode, 'end')
     start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
     inclinationDegree = math.degrees(getInclination(end, start))
     self.elementNode = elementNode
     self.inclination = math.radians(
         evaluate.getEvaluatedFloat(inclinationDegree, elementNode,
                                    'inclination'))
     self.overhangRadians = setting.getOverhangRadians(elementNode)
     self.overhangSpan = setting.getOverhangSpan(elementNode)
     self.radius = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', 1.0)
     size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
     if size != None:
         self.radius = 0.5 * size
     self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
     if self.sides == None:
         self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
             elementNode, self.radius)
     self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.radius, self.sides)
예제 #8
0
 def __init__(self, elementNode, prefix):
     'Set defaults.'
     self.overhangRadians = setting.getOverhangRadians(elementNode)
     self.overhangInclinationRadians = math.radians(
         evaluate.getEvaluatedFloat(0.0, elementNode,
                                    prefix + 'inclination'))
예제 #9
0
파일: overhang.py 프로젝트: Ademan/Cura
	def __init__(self, elementNode, prefix):
		'Set defaults.'
		self.overhangRadians = setting.getOverhangRadians(elementNode)
		self.overhangInclinationRadians = math.radians(evaluate.getEvaluatedFloat(0.0, elementNode,  prefix + 'inclination'))