Beispiel #1
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertices from attribute dictionary."
    if '_arguments' in xmlElement.attributeDictionary:
        arguments = xmlElement.attributeDictionary['_arguments']
        if len(arguments) > 0:
            xmlElement.attributeDictionary['sides'] = arguments[0]
    sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement)
    sideAngle = 2.0 * math.pi / float(sides)
    radiusXY = evaluate.RadiusXY().getByRadius(
        getRadiusFromXMLElement(sideAngle, xmlElement), xmlElement)
    loop = []
    sidesCeiling = int(math.ceil(abs(sides)))
    start = evaluate.getEvaluatedIntZero('start', xmlElement)
    start = getWrappedInteger(start, sidesCeiling)
    extent = evaluate.getEvaluatedIntDefault(sidesCeiling - start, 'extent',
                                             xmlElement)
    end = evaluate.getEvaluatedIntDefault(start + extent, 'end', xmlElement)
    end = getWrappedInteger(end, sidesCeiling)
    for side in xrange(start, min(end, sidesCeiling)):
        angle = float(side) * sideAngle
        point = euclidean.getWiddershinsUnitPolar(angle)
        vertex = Vector3(point.real * radiusXY.radiusX,
                         point.imag * radiusXY.radiusY)
        loop.append(vertex)
    sideLength = sideAngle * radiusXY.radius
    return lineation.getGeometryOutputByLoop(
        None, lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
Beispiel #2
0
	def __init__(self, modulo, prefix, xmlElement):
		"Initialize."
		self.start = evaluate.getEvaluatedIntZero(prefix + 'start', xmlElement)
		self.start = getWrappedInteger(self.start, modulo)
		self.extent = evaluate.getEvaluatedIntDefault(modulo - self.start, prefix + 'extent', xmlElement)
		self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent, prefix + 'end', xmlElement)
		self.end = getWrappedInteger(self.end, modulo)
		self.revolutions = evaluate.getEvaluatedIntOne(prefix + 'revolutions', xmlElement)
		if self.revolutions > 1:
			self.end += modulo * (self.revolutions - 1)
Beispiel #3
0
 def __init__(self, modulo, prefix, xmlElement):
     "Initialize."
     self.start = evaluate.getEvaluatedIntZero(prefix + 'start', xmlElement)
     self.start = getWrappedInteger(self.start, modulo)
     self.extent = evaluate.getEvaluatedIntDefault(modulo - self.start,
                                                   prefix + 'extent',
                                                   xmlElement)
     self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent,
                                                prefix + 'end', xmlElement)
     self.end = getWrappedInteger(self.end, modulo)
     self.revolutions = evaluate.getEvaluatedIntOne(prefix + 'revolutions',
                                                    xmlElement)
     if self.revolutions > 1:
         self.end += modulo * (self.revolutions - 1)
Beispiel #4
0
def getGeometryOutput( xmlElement ):
	"Get vector3 vertices from attribute dictionary."
	if '_arguments' in xmlElement.attributeDictionary:
		arguments = xmlElement.attributeDictionary[ '_arguments' ]
		if len( arguments ) > 0:
			xmlElement.attributeDictionary[ 'sides' ] = arguments[ 0 ]
	sides = evaluate.getEvaluatedFloatDefault( 4.0, 'sides', xmlElement )
	sideAngle = 2.0 * math.pi / float( sides )
	radiusXY = evaluate.RadiusXY().getByRadius( getRadiusFromXMLElement( sideAngle, xmlElement ), xmlElement )
	loop = []
	sidesCeiling = int( math.ceil( abs( sides ) ) )
	start = evaluate.getEvaluatedIntZero( 'start', xmlElement )
	start = getWrappedInteger( start, sidesCeiling )
	extent = evaluate.getEvaluatedIntDefault( sidesCeiling - start, 'extent', xmlElement )
	end = evaluate.getEvaluatedIntDefault( start + extent, 'end', xmlElement )
	end = getWrappedInteger( end, sidesCeiling )
	for side in xrange( start, min( end, sidesCeiling ) ):
		angle = float( side ) * sideAngle
		point = euclidean.getWiddershinsUnitPolar( angle )
		vertex = Vector3( point.real * radiusXY.radiusX, point.imag * radiusXY.radiusY )
		loop.append( vertex )
	sideLength = sideAngle * radiusXY.radius
	return lineation.getGeometryOutputByLoop( None, lineation.SideLoop( loop, sideAngle, sideLength ), xmlElement )