Ejemplo n.º 1
0
def getManipulatedPaths(close, loop, prefix, xmlElement):
    "Get path with overhangs removed or filled in."
    if len(loop) < 3:
        return [loop]
    overhangAngle = math.radians(
        xmlElement.getCascadeFloat(45.0, 'overhangangle'))
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi -
                                                           overhangAngle)
    overhangVerticalAngle = math.radians(
        evaluate.getEvaluatedFloatZero(prefix + 'verticalangle', 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)
    ]
Ejemplo n.º 2
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get segment loop."
    if len(loop) < 3:
        return [loop]
    path = evaluate.getPathByPrefix(getSegmentPathDefault(), prefix,
                                    xmlElement)
    if path == getSegmentPathDefault():
        return [loop]
    path = getXNormalizedVector3Path(path)
    segmentCenter = evaluate.getVector3ByPrefix(None, prefix + 'center',
                                                xmlElement)
    if euclidean.getIsWiddershinsByVector3(loop):
        path = path[::-1]
        for point in path:
            point.x = 1.0 - point.x
            if segmentCenter == None:
                point.y = -point.y
    segmentLoop = []
    startEnd = StartEnd(len(loop), prefix, xmlElement)
    for pointIndex in xrange(len(loop)):
        if pointIndex >= startEnd.start and pointIndex < startEnd.end:
            segmentLoop += getSegmentPath(loop, path, pointIndex,
                                          segmentCenter)
        else:
            segmentLoop.append(loop[pointIndex])
    return [euclidean.getLoopWithoutCloseSequentialPoints(close, segmentLoop)]
Ejemplo n.º 3
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get path with overhangs removed or filled in."
    if len(loop) < 3:
        return [loop]
    if not evaluate.getEvaluatedBooleanDefault(True, prefix + 'activate',
                                               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)
    ]
Ejemplo n.º 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]
    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)
    ]
Ejemplo n.º 5
0
def processTargetByFunction(manipulationFunction, target):
    'Process the target by the manipulationFunction.'
    if target.xmlObject == None:
        print(
            'Warning, there is no object in processTargetByFunction in lineation for:'
        )
        print(target)
        return
    geometryOutput = []
    transformedPaths = target.xmlObject.getTransformedPaths()
    for transformedPath in transformedPaths:
        sideLoop = SideLoop(transformedPath)
        sideLoop.rotate(target)
        sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(
            sideLoop.close, sideLoop.loop)
        geometryOutput += manipulationFunction(sideLoop.close, target,
                                               sideLoop.loop, '',
                                               sideLoop.sideLength)
    if len(geometryOutput) < 1:
        print(
            'Warning, there is no geometryOutput in processTargetByFunction in lineation for:'
        )
        print(target)
        return
    removeChildNodesFromElementObject(target)
    path.convertElementNode(target, geometryOutput)
Ejemplo n.º 6
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
    "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(elementNode)
        return [loop]
    derivation = OverhangDerivation(elementNode, prefix)
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(
        0.5 * math.pi - derivation.overhangRadians)
    if derivation.overhangInclinationRadians != 0.0:
        overhangInclinationCosine = abs(
            math.cos(derivation.overhangInclinationRadians))
        if overhangInclinationCosine == 0.0:
            return [loop]
        imaginaryTimesCosine = overhangPlaneAngle.imag * overhangInclinationCosine
        overhangPlaneAngle = euclidean.getNormalized(
            complex(overhangPlaneAngle.real, imaginaryTimesCosine))
    alongAway = AlongAway(loop, overhangPlaneAngle)
    if euclidean.getIsWiddershinsByVector3(loop):
        alterWiddershinsSupportedPath(alongAway, close)
    else:
        alterClockwiseSupportedPath(alongAway, elementNode)
    return [
        euclidean.getLoopWithoutCloseSequentialPoints(close, alongAway.loop)
    ]
Ejemplo n.º 7
0
def getGeometryOutputByEquation( sideLoop, xmlElement ):
	"Get geometry output by manipulation."
	evaluate.alterVerticesByEquation( sideLoop.loop, xmlElement )
	sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints( sideLoop.close, sideLoop.loop )
	sideLoop.loop = getSegmentLoop( sideLoop.close, sideLoop.loop, xmlElement )
	sideLoop.loop = getBevelLoop( sideLoop.close, sideLoop.loop, sideLoop.sideLength, xmlElement )
	sideLoop.loop = getRoundLoop( sideLoop.close, sideLoop.loop, sideLoop.sideLength, xmlElement )
	return sideLoop.getManipulationPluginLoops( xmlElement )
Ejemplo n.º 8
0
def getGeometryOutputByLoopFunction(manipulationFunction, sideLoop,
                                    xmlElement):
    "Get geometry output by side loop."
    sideLoop.rotate(xmlElement)
    sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(
        sideLoop.close, sideLoop.loop)
    return getUnpackedLoops(
        manipulationFunction(sideLoop.close, sideLoop.loop, '',
                             sideLoop.sideLength, xmlElement))
Ejemplo n.º 9
0
def getBevelLoop( close, loop, sideLength, xmlElement ):
	"Get bevel loop."
	radius = getRadiusByPrefix( 'bevel', sideLength, xmlElement )
	if radius == 0.0:
		return loop
	bevelLoop = []
	for pointIndex in xrange( len( loop ) ):
		begin = loop[ ( pointIndex + len( loop ) - 1 ) % len( loop ) ]
		center = loop[ pointIndex ]
		end = loop[ ( pointIndex + 1 ) % len( loop ) ]
		bevelLoop += getBevelPath( begin, center, close, end, radius )
	return euclidean.getLoopWithoutCloseSequentialPoints( close, bevelLoop )
Ejemplo n.º 10
0
def getRoundLoop( close, loop, sideLength, xmlElement ):
	"Get round loop."
	radius = getRadiusByPrefix( 'round', sideLength, xmlElement )
	if radius == 0.0:
		return loop
	roundLoop = []
	sidesPerRadian = 0.5 / math.pi * evaluate.getSides( sideLength, xmlElement )
	for pointIndex in xrange( len( loop ) ):
		begin = loop[ ( pointIndex + len( loop ) - 1 ) % len( loop ) ]
		center = loop[ pointIndex ]
		end = loop[ ( pointIndex + 1 ) % len( loop ) ]
		roundLoop += getRoundPath( begin, center, close, end, radius, sidesPerRadian )
	return euclidean.getLoopWithoutCloseSequentialPoints( close, roundLoop )
Ejemplo n.º 11
0
Archivo: bevel.py Proyecto: Ademan/Cura
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
	"Get bevel loop."
	if len(loop) < 3:
		return [loop]
	derivation = BevelDerivation(elementNode, prefix, sideLength)
	if derivation.radius == 0.0:
		return loop
	bevelLoop = []
	for pointIndex in xrange(len(loop)):
		begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
		center = loop[pointIndex]
		end = loop[(pointIndex + 1) % len(loop)]
		bevelLoop += getBevelPath(begin, center, close, end, derivation.radius)
	return [euclidean.getLoopWithoutCloseSequentialPoints(close, bevelLoop)]
Ejemplo n.º 12
0
def processSVGElementrect( svgReader, xmlElement ):
	"Process xmlElement by svgReader."
	attributeDictionary = xmlElement.attributeDictionary
	height = euclidean.getFloatDefaultByDictionary( 0.0, attributeDictionary, 'height')
	if height == 0.0:
		print('Warning, in processSVGElementrect in svgReader height is zero in:')
		print(attributeDictionary)
		return
	width = euclidean.getFloatDefaultByDictionary( 0.0, attributeDictionary, 'width')
	if width == 0.0:
		print('Warning, in processSVGElementrect in svgReader width is zero in:')
		print(attributeDictionary)
		return
	center = euclidean.getComplexDefaultByDictionaryKeys(complex(), attributeDictionary, 'x', 'y')
	inradius = 0.5 * complex( width, height )
	cornerRadius = euclidean.getComplexDefaultByDictionaryKeys( complex(), attributeDictionary, 'rx', 'ry')
	rotatedLoopLayer = svgReader.getRotatedLoopLayer()
	if cornerRadius.real == 0.0 and cornerRadius.imag == 0.0:
		inradiusMinusX = complex( - inradius.real, inradius.imag )
		loop = [center + inradius, center + inradiusMinusX, center - inradius, center - inradiusMinusX]
		rotatedLoopLayer.loops += getTransformedFillOutline(loop, xmlElement, svgReader.yAxisPointingUpward)
		return
	if cornerRadius.real == 0.0:
		cornerRadius = complex( cornerRadius.imag, cornerRadius.imag )
	elif cornerRadius.imag == 0.0:
		cornerRadius = complex( cornerRadius.real, cornerRadius.real )
	cornerRadius = complex( min( cornerRadius.real, inradius.real ), min( cornerRadius.imag, inradius.imag ) )
	ellipsePath = [ complex( cornerRadius.real, 0.0 ) ]
	inradiusMinusCorner = inradius - cornerRadius
	loop = []
	global globalNumberOfCornerPoints
	global globalSideAngle
	for side in xrange( 1, globalNumberOfCornerPoints ):
		unitPolar = euclidean.getWiddershinsUnitPolar( float(side) * globalSideAngle )
		ellipsePath.append( complex( unitPolar.real * cornerRadius.real, unitPolar.imag * cornerRadius.imag ) )
	ellipsePath.append( complex( 0.0, cornerRadius.imag ) )
	cornerPoints = []
	for point in ellipsePath:
		cornerPoints.append( point + inradiusMinusCorner )
	cornerPointsReversed = cornerPoints[: : -1]
	for cornerPoint in cornerPoints:
		loop.append( center + cornerPoint )
	for cornerPoint in cornerPointsReversed:
		loop.append( center + complex( - cornerPoint.real, cornerPoint.imag ) )
	for cornerPoint in cornerPoints:
		loop.append( center - cornerPoint )
	for cornerPoint in cornerPointsReversed:
		loop.append( center + complex( cornerPoint.real, - cornerPoint.imag ) )
	loop = euclidean.getLoopWithoutCloseSequentialPoints( 0.0001 * abs(inradius), loop )
	rotatedLoopLayer.loops += getTransformedFillOutline(loop, xmlElement, svgReader.yAxisPointingUpward)
Ejemplo n.º 13
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get bevel loop."
    if len(loop) < 3:
        return [loop]
    radius = lineation.getRadiusByPrefix(prefix, sideLength, xmlElement)
    if radius == 0.0:
        return loop
    bevelLoop = []
    for pointIndex in xrange(len(loop)):
        begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
        center = loop[pointIndex]
        end = loop[(pointIndex + 1) % len(loop)]
        bevelLoop += getBevelPath(begin, center, close, end, radius)
    return [euclidean.getLoopWithoutCloseSequentialPoints(close, bevelLoop)]
Ejemplo n.º 14
0
def processSVGElementrect( svgReader, xmlElement ):
	"Process xmlElement by svgReader."
	attributeDictionary = xmlElement.attributeDictionary
	height = euclidean.getFloatDefaultByDictionary( 0.0, attributeDictionary, 'height')
	if height == 0.0:
		print('Warning, in processSVGElementrect in svgReader height is zero in:')
		print(attributeDictionary)
		return
	width = euclidean.getFloatDefaultByDictionary( 0.0, attributeDictionary, 'width')
	if width == 0.0:
		print('Warning, in processSVGElementrect in svgReader width is zero in:')
		print(attributeDictionary)
		return
	center = euclidean.getComplexDefaultByDictionaryKeys(complex(), attributeDictionary, 'x', 'y')
	inradius = 0.5 * complex( width, height )
	cornerRadius = euclidean.getComplexDefaultByDictionaryKeys( complex(), attributeDictionary, 'rx', 'ry')
	rotatedLoopLayer = svgReader.getRotatedLoopLayer()
	if cornerRadius.real == 0.0 and cornerRadius.imag == 0.0:
		inradiusMinusX = complex( - inradius.real, inradius.imag )
		loop = [center + inradius, center + inradiusMinusX, center - inradius, center - inradiusMinusX]
		rotatedLoopLayer.loops += getTransformedFillOutline(loop, xmlElement, svgReader.yAxisPointingUpward)
		return
	if cornerRadius.real == 0.0:
		cornerRadius = complex( cornerRadius.imag, cornerRadius.imag )
	elif cornerRadius.imag == 0.0:
		cornerRadius = complex( cornerRadius.real, cornerRadius.real )
	cornerRadius = complex( min( cornerRadius.real, inradius.real ), min( cornerRadius.imag, inradius.imag ) )
	ellipsePath = [ complex( cornerRadius.real, 0.0 ) ]
	inradiusMinusCorner = inradius - cornerRadius
	loop = []
	global globalNumberOfCornerPoints
	global globalSideAngle
	for side in xrange( 1, globalNumberOfCornerPoints ):
		unitPolar = euclidean.getWiddershinsUnitPolar( float(side) * globalSideAngle )
		ellipsePath.append( complex( unitPolar.real * cornerRadius.real, unitPolar.imag * cornerRadius.imag ) )
	ellipsePath.append( complex( 0.0, cornerRadius.imag ) )
	cornerPoints = []
	for point in ellipsePath:
		cornerPoints.append( point + inradiusMinusCorner )
	cornerPointsReversed = cornerPoints[: : -1]
	for cornerPoint in cornerPoints:
		loop.append( center + cornerPoint )
	for cornerPoint in cornerPointsReversed:
		loop.append( center + complex( - cornerPoint.real, cornerPoint.imag ) )
	for cornerPoint in cornerPoints:
		loop.append( center - cornerPoint )
	for cornerPoint in cornerPointsReversed:
		loop.append( center + complex( cornerPoint.real, - cornerPoint.imag ) )
	loop = euclidean.getLoopWithoutCloseSequentialPoints( 0.0001 * abs(inradius), loop )
	rotatedLoopLayer.loops += getTransformedFillOutline(loop, xmlElement, svgReader.yAxisPointingUpward)
Ejemplo n.º 15
0
def getManipulatedPaths( close, loop, prefix, sideLength, xmlElement ):
	"Get bevel loop."
	if len(loop) < 3:
		return [loop]
	radius = lineation.getRadiusByPrefix( prefix, sideLength, xmlElement )
	if radius == 0.0:
		return loop
	bevelLoop = []
	for pointIndex in xrange(len(loop)):
		begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
		center = loop[pointIndex]
		end = loop[(pointIndex + 1) % len(loop)]
		bevelLoop += getBevelPath( begin, center, close, end, radius )
	return [ euclidean.getLoopWithoutCloseSequentialPoints( close, bevelLoop ) ]
Ejemplo n.º 16
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
    "Get bevel loop."
    if len(loop) < 3:
        return [loop]
    derivation = BevelDerivation(elementNode, prefix, sideLength)
    if derivation.radius == 0.0:
        return loop
    bevelLoop = []
    for pointIndex in xrange(len(loop)):
        begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
        center = loop[pointIndex]
        end = loop[(pointIndex + 1) % len(loop)]
        bevelLoop += getBevelPath(begin, center, close, end, derivation.radius)
    return [euclidean.getLoopWithoutCloseSequentialPoints(close, bevelLoop)]
Ejemplo n.º 17
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get round loop."
	if len(loop) < 3:
		return [loop]
	radius = lineation.getRadiusByPrefix(prefix, sideLength, xmlElement)
	if radius == 0.0:
		return loop
	roundLoop = []
	sidesPerRadian = 0.5 / math.pi * evaluate.getSidesMinimumThree(sideLength, xmlElement)
	for pointIndex in xrange(len(loop)):
		begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
		center = loop[pointIndex]
		end = loop[(pointIndex + 1) % len(loop)]
		roundLoop += getRoundPath(begin, center, close, end, radius, sidesPerRadian)
	return [euclidean.getLoopWithoutCloseSequentialPoints(close, roundLoop)]
Ejemplo n.º 18
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
    "Get round loop."
    if len(loop) < 3:
        return [loop]
    derivation = RoundDerivation(elementNode, prefix, sideLength)
    if derivation.radius == 0.0:
        return loop
    roundLoop = []
    sidesPerRadian = 0.5 / math.pi * evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, sideLength)
    for pointIndex in xrange(len(loop)):
        begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
        center = loop[pointIndex]
        end = loop[(pointIndex + 1) % len(loop)]
        roundLoop += getRoundPath(begin, center, close, end, derivation.radius, sidesPerRadian)
    return [euclidean.getLoopWithoutCloseSequentialPoints(close, roundLoop)]
Ejemplo n.º 19
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get round loop."
	if len(loop) < 3:
		return [loop]
	radius = lineation.getRadiusByPrefix(prefix, sideLength, xmlElement)
	if radius == 0.0:
		return loop
	roundLoop = []
	sidesPerRadian = 0.5 / math.pi * evaluate.getSidesMinimumThreeBasedOnPrecision(sideLength, xmlElement)
	for pointIndex in xrange(len(loop)):
		begin = loop[(pointIndex + len(loop) - 1) % len(loop)]
		center = loop[pointIndex]
		end = loop[(pointIndex + 1) % len(loop)]
		roundLoop += getRoundPath(begin, center, close, end, radius, sidesPerRadian)
	return [euclidean.getLoopWithoutCloseSequentialPoints(close, roundLoop)]
Ejemplo n.º 20
0
def getSegmentLoop( close, loop, xmlElement ):
	"Get segment loop."
	path = evaluate.getPathByPrefix( getSegmentPathDefault(), 'segment', xmlElement )
	if path == getSegmentPathDefault():
		return loop
	path = getXNormalizedVector3Path( path )
	segmentCenter = evaluate.getVector3ByKey( 'segmentcenter', None, xmlElement )
	if euclidean.getIsWiddershinsByVector3( loop ):
		path = path[ : : - 1 ]
		for point in path:
			point.x = 1.0 - point.x
			if segmentCenter == None:
				point.y = - point.y
	segmentLoop = []
	for pointIndex in xrange( len( loop ) ):
		segmentLoop += getSegmentPath( loop, path, pointIndex, segmentCenter )
	return euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop )
Ejemplo n.º 21
0
def getManipulatedPaths(close, loop, prefix, xmlElement):
    "Get path with overhangs removed or filled in."
    if len(loop) < 3:
        return [loop]
    overhangAngle = math.radians(xmlElement.getCascadeFloat(45.0, "overhangangle"))
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi - overhangAngle)
    overhangVerticalAngle = math.radians(evaluate.getEvaluatedFloatZero(prefix + "verticalangle", 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)]
Ejemplo n.º 22
0
def processTargetByFunction(manipulationFunction, target):
	'Process the target by the manipulationFunction.'
	if target.xmlObject == None:
		print('Warning, there is no object in processTargetByFunction in lineation for:')
		print(target)
		return
	geometryOutput = []
	transformedPaths = target.xmlObject.getTransformedPaths()
	for transformedPath in transformedPaths:
		sideLoop = SideLoop(transformedPath)
		sideLoop.rotate(target)
		sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints( sideLoop.close, sideLoop.loop )
		geometryOutput += manipulationFunction(sideLoop.close, target, sideLoop.loop, '', sideLoop.sideLength)
	if len(geometryOutput) < 1:
		print('Warning, there is no geometryOutput in processTargetByFunction in lineation for:')
		print(target)
		return
	removeChildNodesFromElementObject(target)
	path.convertElementNode(target, geometryOutput)
Ejemplo n.º 23
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
	"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(elementNode)
		return [loop]
	derivation = OverhangDerivation(elementNode, prefix)
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi - derivation.overhangRadians)
	if derivation.overhangInclinationRadians != 0.0:
		overhangInclinationCosine = abs(math.cos(derivation.overhangInclinationRadians))
		if overhangInclinationCosine == 0.0:
			return [loop]
		imaginaryTimesCosine = overhangPlaneAngle.imag * overhangInclinationCosine
		overhangPlaneAngle = euclidean.getNormalized(complex(overhangPlaneAngle.real, imaginaryTimesCosine))
	alongAway = AlongAway(loop, overhangPlaneAngle)
	if euclidean.getIsWiddershinsByVector3(loop):
		alterWiddershinsSupportedPath(alongAway, close)
	else:
		alterClockwiseSupportedPath(alongAway, elementNode)
	return [euclidean.getLoopWithoutCloseSequentialPoints(close,  alongAway.loop)]
Ejemplo n.º 24
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get path with overhangs removed or filled in."
	if len(loop) < 3:
		return [loop]
	if not evaluate.getEvaluatedBooleanDefault( True, prefix + 'activate', 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 ) ]
Ejemplo n.º 25
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)]
Ejemplo n.º 26
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
	"Get segment loop."
	if len(loop) < 3:
		return [loop]
	derivation = SegmentDerivation(elementNode, prefix)
	if derivation.path == getSegmentPathDefault():
		return [loop]
	path = getXNormalizedVector3Path(derivation.path)
	if euclidean.getIsWiddershinsByVector3(loop):
		path = path[: : -1]
		for point in path:
			point.x = 1.0 - point.x
			if derivation.center == None:
				point.y = - point.y
	segmentLoop = []
	startEnd = StartEnd(elementNode, len(loop), prefix)
	for pointIndex in xrange(len(loop)):
		if pointIndex >= startEnd.start and pointIndex < startEnd.end:
			segmentLoop += getSegmentPath(derivation.center, loop, path, pointIndex)
		else:
			segmentLoop.append(loop[pointIndex])
	return [euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop)]
Ejemplo n.º 27
0
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
	"Get segment loop."
	if len(loop) < 3:
		return [loop]
	derivation = SegmentDerivation(elementNode, prefix)
	if derivation.path == getSegmentPathDefault():
		return [loop]
	path = getXNormalizedVector3Path(derivation.path)
	if euclidean.getIsWiddershinsByVector3(loop):
		path = path[: : -1]
		for point in path:
			point.x = 1.0 - point.x
			if derivation.center == None:
				point.y = - point.y
	segmentLoop = []
	startEnd = StartEnd(elementNode, len(loop), prefix)
	for pointIndex in xrange(len(loop)):
		if pointIndex >= startEnd.start and pointIndex < startEnd.end:
			segmentLoop += getSegmentPath(derivation.center, loop, path, pointIndex)
		else:
			segmentLoop.append(loop[pointIndex])
	return [euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop)]
Ejemplo n.º 28
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get segment loop."
	if len(loop) < 3:
		return [loop]
	path = evaluate.getPathByPrefix( getSegmentPathDefault(), prefix, xmlElement )
	if path == getSegmentPathDefault():
		return [loop]
	path = getXNormalizedVector3Path(path)
	segmentCenter = evaluate.getVector3ByPrefix( prefix + 'center', None, xmlElement )
	if euclidean.getIsWiddershinsByVector3(loop):
		path = path[: : -1]
		for point in path:
			point.x = 1.0 - point.x
			if segmentCenter == None:
				point.y = - point.y
	segmentLoop = []
	startEnd = lineation.StartEnd( len(loop), prefix, xmlElement )
	for pointIndex in xrange(len(loop)):
		if pointIndex >= startEnd.start and pointIndex < startEnd.end:
			segmentLoop += getSegmentPath( loop, path, pointIndex, segmentCenter )
		else:
			segmentLoop.append( loop[pointIndex] )
	return [ euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop ) ]
Ejemplo n.º 29
0
def getGeometryOutputByManipulation(elementNode, sideLoop):
    'Get geometry output by manipulation.'
    sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(
        sideLoop.close, sideLoop.loop)
    return sideLoop.getManipulationPluginLoops(elementNode)
Ejemplo n.º 30
0
def getGeometryOutputByManipulation(sideLoop, xmlElement):
    "Get geometry output by manipulation."
    sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(
        sideLoop.close, sideLoop.loop)
    return sideLoop.getManipulationPluginLoops(xmlElement)
Ejemplo n.º 31
0
def getGeometryOutputByManipulation(elementNode, sideLoop):
	'Get geometry output by manipulation.'
	sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints( sideLoop.close, sideLoop.loop )
	return sideLoop.getManipulationPluginLoops(elementNode)
Ejemplo n.º 32
0
def getGeometryOutputByManipulation( sideLoop, xmlElement ):
	"Get geometry output by manipulation."
	sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints( sideLoop.close, sideLoop.loop )
	return sideLoop.getManipulationPluginLoops(xmlElement)
Ejemplo n.º 33
0
def getGeometryOutputByLoopFunction( manipulationFunction, sideLoop, xmlElement ):
	"Get geometry output by side loop."
	sideLoop.rotate(xmlElement)
	sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints( sideLoop.close, sideLoop.loop )
	return getUnpackedLoops( manipulationFunction( sideLoop.close, sideLoop.loop, '', sideLoop.sideLength, xmlElement ) )