Exemplo n.º 1
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.sides = evaluate.getEvaluatedFloatDefault(self.sides, 'sides',
                                                    xmlElement)
     self.sideAngle = 2.0 * math.pi / self.sides
     self.radius = lineation.getComplexByMultiplierPrefixes(
         math.cos(0.5 * self.sideAngle), ['apothem', 'inradius'],
         self.radius, xmlElement)
     self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'],
                                                  self.radius, xmlElement)
     self.radius = lineation.getComplexByMultiplierPrefixes(
         2.0, ['diameter', 'size'], self.radius, xmlElement)
     self.sidesCeiling = int(math.ceil(abs(self.sides)))
     self.start = evaluate.getEvaluatedIntDefault(self.start, 'start',
                                                  xmlElement)
     self.start = lineation.getWrappedInteger(self.start, 360.0)
     self.extent = evaluate.getEvaluatedIntDefault(
         self.sidesCeiling - self.start, 'extent', xmlElement)
     self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent,
                                                'end', xmlElement)
     self.end = lineation.getWrappedInteger(self.end, self.sidesCeiling)
     self.revolutions = evaluate.getEvaluatedIntDefault(
         self.revolutions, 'revolutions', xmlElement)
     if self.revolutions > 1:
         self.end += self.sidesCeiling * (self.revolutions - 1)
     self.spiral = evaluate.getVector3ByPrefix(self.spiral, 'spiral',
                                               xmlElement)
Exemplo n.º 2
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.sides = evaluate.getEvaluatedFloat(4.0, elementNode, 'sides')
		self.sideAngle = 2.0 * math.pi / self.sides
		cosSide = math.cos(0.5 * self.sideAngle)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, cosSide, ['apothem', 'inradius'], complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixes(elementNode, ['demisize', 'radius'], self.radius)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, 2.0, ['diameter', 'size'], self.radius)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedInt(0, elementNode, 'start')
		end = evaluate.getEvaluatedInt(self.sidesCeiling, elementNode, 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.extent = evaluate.getEvaluatedInt(end - self.start, elementNode, 'extent')
		self.extent += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
Exemplo n.º 3
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.sides = evaluate.getEvaluatedFloat(4.0, elementNode, 'sides')
		self.sideAngle = 2.0 * math.pi / self.sides
		cosSide = math.cos(0.5 * self.sideAngle)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, cosSide, ['apothem', 'inradius'], complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixes(elementNode, ['demisize', 'radius'], self.radius)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, 2.0, ['diameter', 'size'], self.radius)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedInt(0, elementNode, 'start')
		end = evaluate.getEvaluatedInt(self.sidesCeiling, elementNode, 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.extent = evaluate.getEvaluatedInt(end - self.start, elementNode, 'extent')
		self.extent += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
Exemplo n.º 4
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertices from attribute dictionary."
	radius = complex(1.0, 1.0)
	radius = lineation.getComplexByPrefixes(['demisize', 'radius'], radius, xmlElement)
	radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], radius, xmlElement)
	sides = evaluate.getSidesMinimumThree(max(radius.real, radius.imag), xmlElement)
	sides = evaluate.getEvaluatedFloatDefault(sides, 'sides', 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)
	sidesCeiling = int(math.ceil(abs(sides) * extent / 360.0))
	sideAngle = math.radians(extent) / sidesCeiling
	startAngle = math.radians(start)
	for side in xrange(sidesCeiling + (extent != 360.0)):
		angle = float(side) * sideAngle + startAngle
		point = euclidean.getWiddershinsUnitPolar(angle)
		vertex = Vector3(point.real * radius.real, point.imag * radius.imag)
		loop.append(vertex)
	sideLength = sideAngle * lineation.getAverageRadius(radius)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Exemplo n.º 5
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.sides = evaluate.getEvaluatedFloatDefault(self.sides, 'sides', xmlElement)
		self.sideAngle = 2.0 * math.pi / self.sides
		self.radius = lineation.getComplexByMultiplierPrefixes(math.cos(0.5 * self.sideAngle), ['apothem', 'inradius'], self.radius, xmlElement)
		self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement)
		self.radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], self.radius, xmlElement)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedIntDefault(self.start, 'start', xmlElement)
		self.start = lineation.getWrappedInteger(self.start, 360.0)
		self.extent = evaluate.getEvaluatedIntDefault(self.sidesCeiling - self.start, 'extent', xmlElement)
		self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent, 'end', xmlElement)
		self.end = lineation.getWrappedInteger(self.end, self.sidesCeiling)
		self.revolutions = evaluate.getEvaluatedIntDefault(self.revolutions, 'revolutions', xmlElement)
		if self.revolutions > 1:
			self.end += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix('spiral', self.spiral, xmlElement)
Exemplo n.º 6
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement)
		self.sideAngle = 2.0 * math.pi / self.sides
		cosSide = math.cos(0.5 * self.sideAngle)
		self.radius = lineation.getComplexByMultiplierPrefixes(cosSide, ['apothem', 'inradius'], complex(1.0, 1.0), xmlElement)
		self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement)
		self.radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], self.radius, xmlElement)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedIntDefault(0, 'start', xmlElement)
		self.start = lineation.getWrappedInteger(self.start, 360.0)
		end = evaluate.getEvaluatedIntDefault(self.sidesCeiling, 'end', xmlElement)
		end = lineation.getWrappedInteger(end, self.sidesCeiling)
		self.revolutions = evaluate.getEvaluatedIntDefault(1, 'revolutions', xmlElement)
		self.extent = evaluate.getEvaluatedIntDefault(end - self.start, 'extent', xmlElement)
		self.extent += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
Exemplo n.º 7
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertices from attribute dictionary."
	sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement)
	sideAngle = 2.0 * math.pi / sides
	radius = complex(1.0, 1.0)
	radius = lineation.getComplexByMultiplierPrefixes(math.cos(0.5 * sideAngle), ['apothem', 'inradius'], radius, xmlElement)
	radius = lineation.getComplexByPrefixes(['demisize', 'radius'], radius, xmlElement)
	radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], radius, xmlElement)
	loop = []
	sidesCeiling = int(math.ceil(abs(sides)))
	startEnd = lineation.StartEnd(sidesCeiling, '', xmlElement)
	for side in xrange(startEnd.start, startEnd.end):
		angle = float(side) * sideAngle
		point = euclidean.getWiddershinsUnitPolar(angle)
		vertex = Vector3(point.real * radius.real, point.imag * radius.imag)
		loop.append(vertex)
	sideLength = sideAngle * lineation.getAverageRadius(radius)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Exemplo n.º 8
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement)
	sideAngle = 2.0 * math.pi / sides
	radius = complex(1.0, 1.0)
	radius = lineation.getComplexByMultiplierPrefixes(math.cos(0.5 * sideAngle), ['apothem', 'inradius'], radius, xmlElement)
	radius = lineation.getComplexByPrefixes(['demisize', 'radius'], radius, xmlElement)
	radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], radius, xmlElement)
	loop = []
	sidesCeiling = int(math.ceil(abs(sides)))
	startEnd = lineation.StartEnd(sidesCeiling, '', xmlElement)
	spiral = lineation.Spiral(0.5 * sideAngle / math.pi, xmlElement)
	for side in xrange(startEnd.start, startEnd.end):
		angle = float(side) * sideAngle
		unitPolar = euclidean.getWiddershinsUnitPolar(angle)
		vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * radius.real, unitPolar.imag * radius.imag))
		loop.append(vertex)
	sideLength = sideAngle * lineation.getAverageRadius(radius)
	lineation.setClosedAttribute(startEnd.revolutions, xmlElement)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Exemplo n.º 9
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    sides = evaluate.getEvaluatedFloatDefault(4.0, "sides", xmlElement)
    sideAngle = 2.0 * math.pi / sides
    radius = complex(1.0, 1.0)
    radius = lineation.getComplexByMultiplierPrefixes(
        math.cos(0.5 * sideAngle), ["apothem", "inradius"], radius, xmlElement
    )
    radius = lineation.getComplexByPrefixes(["demisize", "radius"], radius, xmlElement)
    radius = lineation.getComplexByMultiplierPrefixes(2.0, ["diameter", "size"], radius, xmlElement)
    loop = []
    sidesCeiling = int(math.ceil(abs(sides)))
    startEnd = lineation.StartEnd(sidesCeiling, "", xmlElement)
    spiral = lineation.Spiral(0.5 * sideAngle / math.pi, xmlElement)
    for side in xrange(startEnd.start, startEnd.end):
        angle = float(side) * sideAngle
        unitPolar = euclidean.getWiddershinsUnitPolar(angle)
        vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * radius.real, unitPolar.imag * radius.imag))
        loop.append(vertex)
    sideLength = sideAngle * lineation.getAverageRadius(radius)
    lineation.setClosedAttribute(startEnd.revolutions, xmlElement)
    return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Exemplo n.º 10
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides',
                                                    xmlElement)
     self.sideAngle = 2.0 * math.pi / self.sides
     cosSide = math.cos(0.5 * self.sideAngle)
     self.radius = lineation.getComplexByMultiplierPrefixes(
         cosSide, ['apothem', 'inradius'], complex(1.0, 1.0), xmlElement)
     self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'],
                                                  self.radius, xmlElement)
     self.radius = lineation.getComplexByMultiplierPrefixes(
         2.0, ['diameter', 'size'], self.radius, xmlElement)
     self.sidesCeiling = int(math.ceil(abs(self.sides)))
     self.start = evaluate.getEvaluatedIntDefault(0, 'start', xmlElement)
     self.start = lineation.getWrappedInteger(self.start, 360.0)
     end = evaluate.getEvaluatedIntDefault(self.sidesCeiling, 'end',
                                           xmlElement)
     end = lineation.getWrappedInteger(end, self.sidesCeiling)
     self.revolutions = evaluate.getEvaluatedIntDefault(
         1, 'revolutions', xmlElement)
     self.extent = evaluate.getEvaluatedIntDefault(end - self.start,
                                                   'extent', xmlElement)
     self.extent += self.sidesCeiling * (self.revolutions - 1)
     self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)