コード例 #1
0
ファイル: segment.py プロジェクト: folksjos/RepG
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)]
コード例 #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
ファイル: overhang.py プロジェクト: maestroflema/asimov
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)
    ]
コード例 #4
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)
    ]
コード例 #5
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)
    ]
コード例 #6
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertices from attribute dictionary."
    paths = evaluate.getPathsByKeys(['crosssection', 'section', 'target'],
                                    xmlElement)
    if len(euclidean.getConcatenatedList(paths)) == 0:
        print('Warning, in extrude there are no paths.')
        print(xmlElement.attributeDictionary)
        return None
    offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
    extrude = Extrude()
    extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault(
        extrude.tiltFollow, 'tiltfollow', xmlElement)
    extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop,
                                                  xmlElement)
    extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
        5.0, 'maximumunbuckling', xmlElement)
    scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
    extrude.interpolationDictionary['scale'] = evaluate.Interpolation(
    ).getByPrefixZ(scalePathDefault, 'scale', xmlElement)
    if extrude.tiltTop == None:
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixZ(offsetPathDefault, '', xmlElement)
        tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
        interpolationTilt = evaluate.Interpolation().getByPrefixZ(
            tiltPathDefault, 'tilt', xmlElement)
        extrude.interpolationDictionary['tilt'] = interpolationTilt
        for point in interpolationTilt.path:
            point.x = math.radians(point.x)
            point.y = math.radians(point.y)
    else:
        offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixAlong(offsetAlongDefault, '', xmlElement)
    insertTwistPortions(extrude.interpolationDictionary, xmlElement)
    segments = evaluate.getEvaluatedIntOne('segments', xmlElement)
    negatives = []
    positives = []
    portionDirections = evaluate.getSpacedPortionDirections(
        extrude.interpolationDictionary)
    for path in paths:
        endMultiplier = None
        if not euclidean.getIsWiddershinsByVector3(path):
            endMultiplier = 1.000001
        geometryOutput = getGeometryOutputByPath(endMultiplier, extrude, path,
                                                 portionDirections)
        if endMultiplier == None:
            positives.append(geometryOutput)
        else:
            negatives.append(geometryOutput)
    positiveOutput = trianglemesh.getUnifiedOutput(positives)
    if len(negatives) < 1:
        return positiveOutput
    return {'difference': [positiveOutput] + negatives}
コード例 #7
0
ファイル: extrude.py プロジェクト: bf60tt/ReplicatorG
def addNegativesPositives(extrudeDerivation, negatives, paths, positives):
	"Add pillars output to negatives and positives."
	portionDirections = getSpacedPortionDirections(extrudeDerivation.interpolationDictionary)
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3(path):
			endMultiplier = 1.000001
		geometryOutput = getGeometryOutputByPath(endMultiplier, extrudeDerivation, path, portionDirections)
		if endMultiplier == None:
			positives.append(geometryOutput)
		else:
			negatives.append(geometryOutput)
コード例 #8
0
ファイル: extrude.py プロジェクト: mccoyn/SkeinFactory
def addNegativesPositives(extrudeDerivation, negatives, paths, positives):
	"Add pillars output to negatives and positives."
	portionDirections = getSpacedPortionDirections(extrudeDerivation.interpolationDictionary)
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3(path):
			endMultiplier = 1.000001
		geometryOutput = getGeometryOutputByPath(endMultiplier, extrudeDerivation, path, portionDirections)
		if endMultiplier == None:
			positives.append(geometryOutput)
		else:
			negatives.append(geometryOutput)
コード例 #9
0
ファイル: extrude.py プロジェクト: Spacexula/SFACT
def addNegativesPositives(derivation, negatives, paths, positives):
	'Add pillars output to negatives and positives.'
	portionDirections = getSpacedPortionDirections(derivation.interpolationDictionary)
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3(path):
			endMultiplier = 1.000001
		loopLists = getLoopListsByPath(derivation, endMultiplier, path, portionDirections)
		geometryOutput = triangle_mesh.getPillarsOutput(loopLists)
		if endMultiplier == None:
			positives.append(geometryOutput)
		else:
			negatives.append(geometryOutput)
コード例 #10
0
def addNegativesPositives(derivation, negatives, paths, positives):
	"Add pillars output to negatives and positives."
	portionDirections = getSpacedPortionDirections(derivation.interpolationDictionary)
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3(path):
			endMultiplier = 1.000001
		loopLists = getLoopListsByPath(derivation, endMultiplier, path, portionDirections)
		geometryOutput = trianglemesh.getPillarsOutput(loopLists)
		if endMultiplier == None:
			positives.append(geometryOutput)
		else:
			negatives.append(geometryOutput)
コード例 #11
0
ファイル: lineation.py プロジェクト: 1060460048/Cura
	def rotate(self, elementNode):
		'Rotate.'
		rotation = math.radians(evaluate.getEvaluatedFloat(0.0, elementNode, 'rotation'))
		rotation += evaluate.getEvaluatedFloat(0.0, elementNode, 'rotationOverSide') * self.sideAngle
		if rotation != 0.0:
			planeRotation = euclidean.getWiddershinsUnitPolar( rotation )
			for vertex in self.loop:
				rotatedComplex = vertex.dropAxis() * planeRotation
				vertex.x = rotatedComplex.real
				vertex.y = rotatedComplex.imag
		if 'clockwise' in elementNode.attributes:
			isClockwise = euclidean.getBooleanFromValue(evaluate.getEvaluatedValueObliviously(elementNode, 'clockwise'))
			if isClockwise == euclidean.getIsWiddershinsByVector3( self.loop ):
				self.loop.reverse()
コード例 #12
0
ファイル: lineation.py プロジェクト: greenarrow/skeinforgeGit
	def rotate(self, xmlElement):
		"Rotate."
		rotation = math.radians( evaluate.getEvaluatedFloatDefault(0.0, 'rotation', xmlElement ) )
		rotation += evaluate.getEvaluatedFloatDefault(0.0, 'rotationOverSide', xmlElement ) * self.sideAngle
		if rotation != 0.0:
			planeRotation = euclidean.getWiddershinsUnitPolar( rotation )
			for vertex in self.loop:
				rotatedComplex = vertex.dropAxis() * planeRotation
				vertex.x = rotatedComplex.real
				vertex.y = rotatedComplex.imag
		if 'clockwise' in xmlElement.attributeDictionary:
			isClockwise = euclidean.getBooleanFromValue( evaluate.getEvaluatedValueObliviously('clockwise', xmlElement ) )
			if isClockwise == euclidean.getIsWiddershinsByVector3( self.loop ):
				self.loop.reverse()
コード例 #13
0
ファイル: lineation.py プロジェクト: maestroflema/asimov
	def rotate(self, elementNode):
		'Rotate.'
		rotation = math.radians(evaluate.getEvaluatedFloat(0.0, elementNode, 'rotation'))
		rotation += evaluate.getEvaluatedFloat(0.0, elementNode, 'rotationOverSide') * self.sideAngle
		if rotation != 0.0:
			planeRotation = euclidean.getWiddershinsUnitPolar( rotation )
			for vertex in self.loop:
				rotatedComplex = vertex.dropAxis() * planeRotation
				vertex.x = rotatedComplex.real
				vertex.y = rotatedComplex.imag
		if 'clockwise' in elementNode.attributes:
			isClockwise = euclidean.getBooleanFromValue(evaluate.getEvaluatedValueObliviously(elementNode, 'clockwise'))
			if isClockwise == euclidean.getIsWiddershinsByVector3( self.loop ):
				self.loop.reverse()
コード例 #14
0
ファイル: lineation.py プロジェクト: elmom/Skeinforge-Mirror
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 )
コード例 #15
0
ファイル: lineation.py プロジェクト: folksjos/RepG
 def rotate(self, xmlElement):
     "Rotate."
     rotation = math.radians(
         evaluate.getEvaluatedFloatDefault(0.0, 'rotation', xmlElement))
     rotation += evaluate.getEvaluatedFloatDefault(
         0.0, 'rotationOverSide', xmlElement) * self.sideAngle
     if rotation != 0.0:
         planeRotation = euclidean.getWiddershinsUnitPolar(rotation)
         for vertex in self.loop:
             rotatedComplex = vertex.dropAxis() * planeRotation
             vertex.x = rotatedComplex.real
             vertex.y = rotatedComplex.imag
     if 'clockwise' in xmlElement.attributeDictionary:
         isClockwise = euclidean.getBooleanFromValue(
             evaluate.getEvaluatedValueObliviously('clockwise', xmlElement))
         if isClockwise == euclidean.getIsWiddershinsByVector3(self.loop):
             self.loop.reverse()
コード例 #16
0
ファイル: lineation.py プロジェクト: elmom/Skeinforge-Mirror
	def centerRotate( self, xmlElement ):
		"Add a wedge center and rotate."
		wedgeCenter = evaluate.getVector3ByKey( 'wedgecenter', None, xmlElement )
		if wedgeCenter != None:
			self.loop.append( wedgeCenter )
		rotation = math.radians( evaluate.getEvaluatedFloatZero( 'rotation', xmlElement ) )
		rotation += evaluate.getEvaluatedFloatZero( 'rotationoverside', xmlElement ) * self.sideAngle
		if rotation != 0.0:
			planeRotation = euclidean.getWiddershinsUnitPolar( rotation )
			for vertex in self.loop:
				rotatedComplex = vertex.dropAxis() * planeRotation
				vertex.x = rotatedComplex.real
				vertex.y = rotatedComplex.imag
		if 'clockwise' in xmlElement.attributeDictionary:
			isClockwise = euclidean.getBooleanFromValue( evaluate.getEvaluatedValueObliviously( 'clockwise', xmlElement ) )
			if isClockwise == euclidean.getIsWiddershinsByVector3( self.loop ):
				self.loop.reverse()
コード例 #17
0
ファイル: extrude.py プロジェクト: clothbot/DotSkeinforge
def getGeometryOutput(xmlElement):
	"Get triangle mesh from attribute dictionary."
	paths = evaluate.getPathsByKeys( ['crosssection', 'section', 'target'], xmlElement )
	if len( euclidean.getConcatenatedList( paths ) ) == 0:
		print('Warning, in extrude there are no paths.')
		print( xmlElement.attributeDictionary )
		return None
	offsetPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
	extrude = Extrude()
	extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault( extrude.tiltFollow, 'tiltfollow', xmlElement )
	extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop, xmlElement )
	extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault( 5.0, 'maximumunbuckling', xmlElement )
	scalePathDefault = [ Vector3( 1.0, 1.0, 0.0 ), Vector3( 1.0, 1.0, 1.0 ) ]
	extrude.interpolationDictionary['scale'] = Interpolation().getByPrefixZ( scalePathDefault, 'scale', xmlElement )
	if extrude.tiltTop == None:
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixZ( offsetPathDefault, '', xmlElement )
		tiltPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
		interpolationTilt = Interpolation().getByPrefixZ( tiltPathDefault, 'tilt', xmlElement )
		extrude.interpolationDictionary['tilt'] = interpolationTilt
		for point in interpolationTilt.path:
			point.x = math.radians( point.x )
			point.y = math.radians( point.y )
	else:
		offsetAlongDefault = [ Vector3(), Vector3( 1.0, 0.0, 0.0 ) ]
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong( offsetAlongDefault, '', xmlElement )
	insertTwistPortions( extrude.interpolationDictionary, xmlElement )
	segments = evaluate.getEvaluatedIntOne('segments', xmlElement )
	negatives = []
	positives = []
	portionDirections = getSpacedPortionDirections( extrude.interpolationDictionary )
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3( path ):
			endMultiplier = 1.000001
		geometryOutput = getGeometryOutputByPath( endMultiplier, extrude, path, portionDirections )
		if endMultiplier == None:
			positives.append( geometryOutput )
		else:
			negatives.append( geometryOutput )
	positiveOutput = trianglemesh.getUnifiedOutput( positives )
	interpolationOffset = extrude.interpolationDictionary['offset']
	if len( negatives ) < 1:
		return getGeometryOutputWithConnection( positiveOutput, interpolationOffset, xmlElement )
	return getGeometryOutputWithConnection( { 'difference' : [ positiveOutput ] + negatives }, interpolationOffset, xmlElement )
コード例 #18
0
ファイル: overhang.py プロジェクト: elmom/Skeinforge-Mirror
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)]
コード例 #19
0
ファイル: overhang.py プロジェクト: Ademan/Cura
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)]
コード例 #20
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)]
コード例 #21
0
ファイル: overhang.py プロジェクト: folksjos/RepG
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 ) ]
コード例 #22
0
ファイル: segment.py プロジェクト: folksjos/RepG
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)]
コード例 #23
0
ファイル: segment.py プロジェクト: maestroflema/asimov
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)]
コード例 #24
0
ファイル: segment.py プロジェクト: mccoyn/SkeinFactory
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 ) ]