예제 #1
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)
예제 #2
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)
예제 #3
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)
예제 #4
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)
예제 #5
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)