def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(self.tiltFollow, "tiltfollow", xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix("tilttop", self.tiltTop, xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         self.maximumUnbuckling, "maximumUnbuckling", xmlElement
     )
     self.interpolationDictionary["scale"] = Interpolation().getByPrefixZ(self.scalePathDefault, "scale", xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey("target", xmlElement)
     if self.tiltTop == None:
         self.interpolationDictionary["offset"] = Interpolation().getByPrefixZ(
             self.offsetPathDefault, "", xmlElement
         )
         self.interpolationDictionary["tilt"] = Interpolation().getByPrefixZ(
             self.tiltPathDefault, "tilt", xmlElement
         )
         for point in self.interpolationDictionary["tilt"].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         self.interpolationDictionary["offset"] = Interpolation().getByPrefixAlong(
             self.offsetAlongDefault, "", xmlElement
         )
     self.twist = evaluate.getEvaluatedFloatDefault(self.twist, "twist", xmlElement)
     if self.twist != 0.0:
         self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
	def __init__(self, xmlElement):
		'Initialize.'
		self.interpolationDictionary = {}
		self.radius = lineation.getRadiusComplex(complex(), xmlElement)
		self.tiltFollow = evaluate.getEvaluatedBoolean(True, 'tiltFollow', xmlElement)
		self.tiltTop = evaluate.getVector3ByPrefix(None, 'tiltTop', xmlElement)
		self.maximumUnbuckling = evaluate.getEvaluatedFloat(5.0, 'maximumUnbuckling', xmlElement)
		scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
		self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(scalePathDefault, 'scale', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		if self.tiltTop == None:
			offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixZ(offsetPathDefault, '', xmlElement)
			tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
			self.interpolationDictionary['tilt'] = Interpolation().getByPrefixZ(tiltPathDefault, 'tilt', xmlElement)
			for point in self.interpolationDictionary['tilt'].path:
				point.x = math.radians(point.x)
				point.y = math.radians(point.y)
		else:
			offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong(offsetAlongDefault, '', xmlElement)
		self.twist = evaluate.getEvaluatedFloat(0.0, 'twist', xmlElement )
		self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist) ]
		self.xmlElement = xmlElement
		insertTwistPortions(self, xmlElement)
Beispiel #3
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(
         self.tiltFollow, 'tiltfollow', xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix(self.tiltTop, 'tilttop',
                                                xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         self.maximumUnbuckling, 'maximumUnbuckling', xmlElement)
     self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(
         self.scalePathDefault, 'scale', xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey(
             'target', xmlElement)
     if self.tiltTop == None:
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixZ(self.offsetPathDefault, '', xmlElement)
         self.interpolationDictionary['tilt'] = Interpolation(
         ).getByPrefixZ(self.tiltPathDefault, 'tilt', xmlElement)
         for point in self.interpolationDictionary['tilt'].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixAlong(self.offsetAlongDefault, '', xmlElement)
     self.twist = evaluate.getEvaluatedFloatDefault(self.twist, 'twist',
                                                    xmlElement)
     if self.twist != 0.0:
         self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
Beispiel #4
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	radius = lineation.getRadiusComplex(complex(1.0, 1.0), xmlElement)
	sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(max(radius.real, radius.imag), xmlElement)
	loop = []
	start = evaluate.getEvaluatedFloatZero('start', xmlElement)
	start = getWrappedFloat(start, 360.0)
	extent = evaluate.getEvaluatedFloatDefault(360.0 - start, 'extent', xmlElement)
	end = evaluate.getEvaluatedFloatDefault(start + extent, 'end', xmlElement)
	end = getWrappedFloat(end, 360.0)
	revolutions = evaluate.getEvaluatedFloatOne('revolutions', xmlElement)
	if revolutions > 1:
		end += 360.0 * (revolutions - 1)
	angleTotal = math.radians(start)
	extent = end - start
	sidesCeiling = int(math.ceil(abs(sides) * extent / 360.0))
	sideAngle = math.radians(extent) / sidesCeiling
	spiral = lineation.Spiral(0.5 * sideAngle / math.pi, xmlElement)
	for side in xrange(sidesCeiling + (extent != 360.0)):
		unitPolar = euclidean.getWiddershinsUnitPolar(angleTotal)
		vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * radius.real, unitPolar.imag * radius.imag))
		angleTotal += sideAngle
		loop.append(vertex)
	sideLength = sideAngle * lineation.getAverageRadius(radius)
	lineation.setClosedAttribute(revolutions, xmlElement)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Beispiel #5
0
 def __init__(self, xmlElement):
     'Initialize.'
     self.interpolationDictionary = {}
     self.radius = lineation.getRadiusComplex(complex(), xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(
         True, 'tiltFollow', xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix(None, 'tiltTop', xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         5.0, 'maximumUnbuckling', xmlElement)
     scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
     self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(
         scalePathDefault, 'scale', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     if self.tiltTop == None:
         offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixZ(offsetPathDefault, '', xmlElement)
         tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
         self.interpolationDictionary['tilt'] = Interpolation(
         ).getByPrefixZ(tiltPathDefault, 'tilt', xmlElement)
         for point in self.interpolationDictionary['tilt'].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixAlong(offsetAlongDefault, '', xmlElement)
     self.twist = evaluate.getEvaluatedFloatDefault(0.0, 'twist',
                                                    xmlElement)
     self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
Beispiel #6
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.radius = lineation.getRadiusComplex(complex(1.0, 1.0), xmlElement)
		self.sides = evaluate.getEvaluatedFloatDefault(None, 'sides', xmlElement)
		if self.sides == None:
			radiusMaximum = max(self.radius.real, self.radius.imag)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(radiusMaximum, xmlElement)
		self.start = evaluate.getEvaluatedFloatDefault(0.0, 'start', xmlElement)
		end = evaluate.getEvaluatedFloatDefault(360.0, 'end', xmlElement)
		self.revolutions = evaluate.getEvaluatedFloatDefault(1.0, 'revolutions', xmlElement)
		self.extent = evaluate.getEvaluatedFloatDefault(end - self.start, 'extent', xmlElement)
		self.extent += 360.0 * (self.revolutions - 1.0)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
Beispiel #7
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.radius = lineation.getRadiusComplex(elementNode, complex(1.0, 1.0))
		self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
		if self.sides == None:
			radiusMaximum = max(self.radius.real, self.radius.imag)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, radiusMaximum)
		self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(elementNode, self.radius, self.sides)
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
		end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
		self.revolutions = evaluate.getEvaluatedFloat(1.0, elementNode, 'revolutions')
		self.extent = evaluate.getEvaluatedFloat(end - self.start, elementNode, 'extent')
		self.extent += 360.0 * (self.revolutions - 1.0)
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
		if self.sides == None:
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(max(self.radius.real, self.radius.imag), xmlElement)
		self.start = evaluate.getEvaluatedFloatDefault(self.start, 'start', xmlElement)
		self.start = getWrappedFloat(self.start, 360.0)
		self.extent = evaluate.getEvaluatedFloatDefault(360.0 - self.start, 'extent', xmlElement)
		self.end = evaluate.getEvaluatedFloatDefault(self.start + self.extent, 'end', xmlElement)
		self.end = getWrappedFloat(self.end, 360.0)
		self.revolutions = evaluate.getEvaluatedFloatDefault(self.revolutions, 'revolutions', xmlElement)
		if self.revolutions > 1:
			self.end += 360.0 * (self.revolutions - 1)
		self.extent = self.end - self.start
		self.spiral = evaluate.getVector3ByPrefix('spiral', self.spiral, xmlElement)
Beispiel #9
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.radius = lineation.getRadiusComplex(complex(1.0, 1.0), xmlElement)
		self.sides = evaluate.getEvaluatedFloat(None, 'sides', xmlElement)
		if self.sides == None:
			radiusMaximum = max(self.radius.real, self.radius.imag)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(radiusMaximum, xmlElement)
		self.circularizedRadius = self.radius
		if evaluate.getEvaluatedBoolean(False, 'areaRadius', xmlElement):
			self.circularizedRadius *= euclidean.getAreaRadiusMultiplier(self.sides)
		self.start = evaluate.getEvaluatedFloat(0.0, 'start', xmlElement)
		end = evaluate.getEvaluatedFloat(360.0, 'end', xmlElement)
		self.revolutions = evaluate.getEvaluatedFloat(1.0, 'revolutions', xmlElement)
		self.extent = evaluate.getEvaluatedFloat(end - self.start, 'extent', xmlElement)
		self.extent += 360.0 * (self.revolutions - 1.0)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
Beispiel #10
0
 def __init__(self, elementNode):
     'Set defaults.'
     self.radius = lineation.getRadiusComplex(elementNode,
                                              complex(1.0, 1.0))
     self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
     if self.sides == None:
         radiusMaximum = max(self.radius.real, self.radius.imag)
         self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
             elementNode, radiusMaximum)
     self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.radius, self.sides)
     self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
     end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
     self.revolutions = evaluate.getEvaluatedFloat(1.0, elementNode,
                                                   'revolutions')
     self.extent = evaluate.getEvaluatedFloat(end - self.start, elementNode,
                                              'extent')
     self.extent += 360.0 * (self.revolutions - 1.0)
     self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
Beispiel #11
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.radius = lineation.getRadiusComplex(complex(1.0, 1.0), xmlElement)
     self.sides = evaluate.getEvaluatedFloat(None, 'sides', xmlElement)
     if self.sides == None:
         radiusMaximum = max(self.radius.real, self.radius.imag)
         self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
             radiusMaximum, xmlElement)
     self.circularizedRadius = self.radius
     if evaluate.getEvaluatedBoolean(False, 'areaRadius', xmlElement):
         self.circularizedRadius *= euclidean.getAreaRadiusMultiplier(
             self.sides)
     self.start = evaluate.getEvaluatedFloat(0.0, 'start', xmlElement)
     end = evaluate.getEvaluatedFloat(360.0, 'end', xmlElement)
     self.revolutions = evaluate.getEvaluatedFloat(1.0, 'revolutions',
                                                   xmlElement)
     self.extent = evaluate.getEvaluatedFloat(end - self.start, 'extent',
                                              xmlElement)
     self.extent += 360.0 * (self.revolutions - 1.0)
     self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
Beispiel #12
0
def getGeometryOutput(xmlElement):
	"Get triangle mesh from attribute dictionary."
	paths = evaluate.getTransformedPathsByKey('target', xmlElement)
	radius = lineation.getRadiusComplex(complex(), xmlElement)
	if radius != complex():
		sides = int(math.ceil(evaluate.getSidesMinimumThreeBasedOnPrecisionSides(max(radius.real, radius.imag), xmlElement)))
		loop = []
		sideAngle = 2.0 * math.pi / sides
		angleTotal = 0.0
		for side in xrange(sides):
			point = euclidean.getWiddershinsUnitPolar(angleTotal)
			loop.append(Vector3(point.real * radius.real, point.imag * radius.imag))
			angleTotal += sideAngle
		paths = [loop] + paths
	if len(euclidean.getConcatenatedList(paths)) == 0:
		print('Warning, in extrude there are no paths.')
		print(xmlElement.attributeDictionary)
		return None
	extrudeDerivation = ExtrudeDerivation()
	extrudeDerivation.setToXMLElement(xmlElement)
	return getGeometryOutputByExtrudePaths(extrudeDerivation, paths, xmlElement)
Beispiel #13
0
def getGeometryOutput(xmlElement):
	"Get triangle mesh from attribute dictionary."
	paths = evaluate.getTransformedPathsByKey('target', xmlElement)
	radius = lineation.getRadiusComplex(complex(), xmlElement)
	if radius != complex():
		sides = int(math.ceil(evaluate.getSidesMinimumThreeBasedOnPrecisionSides(max(radius.real, radius.imag), xmlElement)))
		loop = []
		sideAngle = 2.0 * math.pi / sides
		angleTotal = 0.0
		for side in xrange(sides):
			point = euclidean.getWiddershinsUnitPolar(angleTotal)
			loop.append(Vector3(point.real * radius.real, point.imag * radius.imag))
			angleTotal += sideAngle
		paths = [loop] + paths
	if len(euclidean.getConcatenatedList(paths)) == 0:
		print('Warning, in extrude there are no paths.')
		print(xmlElement.attributeDictionary)
		return None
	extrudeDerivation = ExtrudeDerivation()
	extrudeDerivation.setToXMLElement(xmlElement)
	return getGeometryOutputByExtrudePaths(extrudeDerivation, paths, xmlElement)
Beispiel #14
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
     if self.sides == None:
         self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
             max(self.radius.real, self.radius.imag), xmlElement)
     self.start = evaluate.getEvaluatedFloatDefault(self.start, 'start',
                                                    xmlElement)
     self.start = getWrappedFloat(self.start, 360.0)
     self.extent = evaluate.getEvaluatedFloatDefault(
         360.0 - self.start, 'extent', xmlElement)
     self.end = evaluate.getEvaluatedFloatDefault(self.start + self.extent,
                                                  'end', xmlElement)
     self.end = getWrappedFloat(self.end, 360.0)
     self.revolutions = evaluate.getEvaluatedFloatDefault(
         self.revolutions, 'revolutions', xmlElement)
     if self.revolutions > 1:
         self.end += 360.0 * (self.revolutions - 1)
     self.extent = self.end - self.start
     self.spiral = evaluate.getVector3ByPrefix('spiral', self.spiral,
                                               xmlElement)