def getGeometryOutput(derivation, elementNode): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = CircleDerivation(elementNode) angleTotal = math.radians(derivation.start) loop = [] sidesCeiling = int( math.ceil(abs(derivation.sides) * derivation.extent / 360.0)) sideAngle = math.radians(derivation.extent) / sidesCeiling if derivation.sides < 0.0: sideAngle = -sideAngle spiral = lineation.Spiral(derivation.spiral, 0.5 * sideAngle / math.pi) for side in xrange(sidesCeiling + 1): unitPolar = euclidean.getWiddershinsUnitPolar(angleTotal) x = unitPolar.real * derivation.radiusArealized.real y = unitPolar.imag * derivation.radiusArealized.imag vertex = spiral.getSpiralPoint(unitPolar, Vector3(x, y)) angleTotal += sideAngle loop.append(vertex) radiusMaximum = 0.000001 * max(derivation.radiusArealized.real, derivation.radiusArealized.imag) loop = euclidean.getLoopWithoutCloseEnds(radiusMaximum, loop) lineation.setClosedAttribute(elementNode, derivation.revolutions) return lineation.getGeometryOutputByLoop( elementNode, lineation.SideLoop(loop, sideAngle))
def getGeometryOutput(derivation, xmlElement): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = SquareDerivation() derivation.setToXMLElement(xmlElement) topRight = complex(derivation.topDemiwidth, derivation.demiheight) topLeft = complex(-derivation.topDemiwidth, derivation.demiheight) bottomLeft = complex(-derivation.bottomDemiwidth, -derivation.demiheight) bottomRight = complex(derivation.bottomDemiwidth, -derivation.demiheight) if derivation.interiorAngle != 90.0: interiorPlaneAngle = euclidean.getWiddershinsUnitPolar(math.radians(derivation.interiorAngle - 90.0)) topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft lineation.setClosedAttribute(derivation.revolutions, xmlElement) complexLoop = [topRight, topLeft, bottomLeft, bottomRight] originalLoop = complexLoop[:] for revolution in xrange(1, derivation.revolutions): complexLoop += originalLoop spiral = lineation.Spiral(derivation.spiral, 0.25) loop = [] loopCentroid = euclidean.getLoopCentroid(originalLoop) for point in complexLoop: unitPolar = euclidean.getNormalized(point - loopCentroid) loop.append(spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag))) return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
def getGeometryOutput(derivation, elementNode): "Get vector3 vertexes from attribute dictionary." if derivation is None: derivation = SquareDerivation(elementNode) topRight = complex(derivation.topDemiwidth, derivation.demiheight) topLeft = complex(-derivation.topDemiwidth, derivation.demiheight) bottomLeft = complex(-derivation.bottomDemiwidth, -derivation.demiheight) bottomRight = complex(derivation.bottomDemiwidth, -derivation.demiheight) if derivation.interiorAngle != 90.0: interiorPlaneAngle = euclidean.getWiddershinsUnitPolar( math.radians(derivation.interiorAngle - 90.0)) topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft lineation.setClosedAttribute(elementNode, derivation.revolutions) complexLoop = [topRight, topLeft, bottomLeft, bottomRight] originalLoop = complexLoop[:] for revolution in xrange(1, derivation.revolutions): complexLoop += originalLoop spiral = lineation.Spiral(derivation.spiral, 0.25) loop = [] loopCentroid = euclidean.getLoopCentroid(originalLoop) for point in complexLoop: unitPolar = euclidean.getNormalized(point - loopCentroid) loop.append( spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag))) return lineation.getGeometryOutputByLoop( elementNode, lineation.SideLoop(loop, 0.5 * math.pi))
def getGeometryOutput(xmlElement): "Get vector3 vertexes from attribute dictionary." inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.0), xmlElement) inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', inradius, xmlElement) demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', inradius.real, xmlElement) demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', inradius.imag, xmlElement) bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', demiwidth, xmlElement) topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', demiwidth, xmlElement) interiorAngle = evaluate.getEvaluatedFloatDefault(90.0, 'interiorangle', xmlElement) topRight = complex(topDemiwidth, demiheight) topLeft = complex(-topDemiwidth, demiheight) bottomLeft = complex(-bottomDemiwidth, -demiheight) bottomRight = complex(bottomDemiwidth, -demiheight) if interiorAngle != 90.0: interiorPlaneAngle = euclidean.getWiddershinsUnitPolar(math.radians(interiorAngle - 90.0)) topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft revolutions = evaluate.getEvaluatedIntOne('revolutions', xmlElement) lineation.setClosedAttribute(revolutions, xmlElement) complexLoop = [topRight, topLeft, bottomLeft, bottomRight] originalLoop = complexLoop[:] for revolution in xrange(1, revolutions): complexLoop += originalLoop spiral = lineation.Spiral(0.25, xmlElement) loop = [] loopCentroid = euclidean.getLoopCentroid(originalLoop) for point in complexLoop: unitPolar = euclidean.getNormalized(point - loopCentroid) loop.append(spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag))) return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
def getGeometryOutput(derivation, xmlElement): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = CircleDerivation(xmlElement) loop = [] angleTotal = math.radians(derivation.start) sidesCeiling = int( math.ceil(abs(derivation.sides) * derivation.extent / 360.0)) sideAngle = math.radians(derivation.extent) / sidesCeiling if derivation.sides < 0.0: sideAngle = -sideAngle spiral = lineation.Spiral(derivation.spiral, 0.5 * sideAngle / math.pi) for side in xrange(sidesCeiling + 1): unitPolar = euclidean.getWiddershinsUnitPolar(angleTotal) vertex = spiral.getSpiralPoint( unitPolar, Vector3(unitPolar.real * derivation.radius.real, unitPolar.imag * derivation.radius.imag)) angleTotal += sideAngle loop.append(vertex) loop = euclidean.getLoopWithoutCloseEnds( 0.000001 * max(derivation.radius.real, derivation.radius.imag), loop) sideLength = sideAngle * lineation.getRadiusAverage(derivation.radius) lineation.setClosedAttribute(derivation.revolutions, xmlElement) return lineation.getGeometryOutputByLoop( lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
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)
def getGeometryOutput(derivation, elementNode): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = PolygonDerivation(elementNode) loop = [] spiral = lineation.Spiral(derivation.spiral, 0.5 * derivation.sideAngle / math.pi) for side in xrange(derivation.start, derivation.start + derivation.extent + 1): angle = float(side) * derivation.sideAngle unitPolar = euclidean.getWiddershinsUnitPolar(angle) vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * derivation.radius.real, unitPolar.imag * derivation.radius.imag)) loop.append(vertex) loop = euclidean.getLoopWithoutCloseEnds(0.000001 * max(derivation.radius.real, derivation.radius.imag), loop) lineation.setClosedAttribute(elementNode, derivation.revolutions) return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(loop, derivation.sideAngle))
def getGeometryOutput(derivation, xmlElement): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = PolygonDerivation() derivation.setToXMLElement(xmlElement) loop = [] spiral = lineation.Spiral(derivation.spiral, 0.5 * derivation.sideAngle / math.pi) for side in xrange(derivation.start, derivation.end): angle = float(side) * derivation.sideAngle unitPolar = euclidean.getWiddershinsUnitPolar(angle) vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * derivation.radius.real, unitPolar.imag * derivation.radius.imag)) loop.append(vertex) sideLength = derivation.sideAngle * lineation.getRadiusAverage(derivation.radius) lineation.setClosedAttribute(derivation.revolutions, xmlElement) return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, derivation.sideAngle, sideLength), xmlElement)
def getGeometryOutput(derivation, xmlElement): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = CircleDerivation(xmlElement) loop = [] angleTotal = math.radians(derivation.start) sidesCeiling = int(math.ceil(abs(derivation.sides) * derivation.extent / 360.0)) sideAngle = math.radians(derivation.extent) / sidesCeiling spiral = lineation.Spiral(derivation.spiral, 0.5 * sideAngle / math.pi) for side in xrange(sidesCeiling + 1): unitPolar = euclidean.getWiddershinsUnitPolar(angleTotal) vertex = spiral.getSpiralPoint(unitPolar, Vector3(unitPolar.real * derivation.radius.real, unitPolar.imag * derivation.radius.imag)) angleTotal += sideAngle loop.append(vertex) loop = euclidean.getLoopWithoutCloseEnds(0.000001 * max(derivation.radius.real, derivation.radius.imag), loop) sideLength = sideAngle * lineation.getRadiusAverage(derivation.radius) lineation.setClosedAttribute(derivation.revolutions, xmlElement) return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, sideAngle, sideLength), xmlElement)
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)
def getGeometryOutput(xmlElement): "Get vector3 vertexes from attribute dictionary." inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.0), xmlElement) inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', inradius, xmlElement) demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', inradius.real, xmlElement) demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', inradius.imag, xmlElement) bottomDemiwidth = lineation.getFloatByPrefixBeginEnd( 'bottomdemiwidth', 'bottomwidth', demiwidth, xmlElement) topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', demiwidth, xmlElement) interiorAngle = evaluate.getEvaluatedFloatDefault(90.0, 'interiorangle', xmlElement) topRight = complex(topDemiwidth, demiheight) topLeft = complex(-topDemiwidth, demiheight) bottomLeft = complex(-bottomDemiwidth, -demiheight) bottomRight = complex(bottomDemiwidth, -demiheight) if interiorAngle != 90.0: interiorPlaneAngle = euclidean.getWiddershinsUnitPolar( math.radians(interiorAngle - 90.0)) topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft revolutions = evaluate.getEvaluatedIntOne('revolutions', xmlElement) lineation.setClosedAttribute(revolutions, xmlElement) complexLoop = [topRight, topLeft, bottomLeft, bottomRight] originalLoop = complexLoop[:] for revolution in xrange(1, revolutions): complexLoop += originalLoop spiral = lineation.Spiral(0.25, xmlElement) loop = [] loopCentroid = euclidean.getLoopCentroid(originalLoop) for point in complexLoop: unitPolar = euclidean.getNormalized(point - loopCentroid) loop.append( spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag))) return lineation.getGeometryOutputByLoop( lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
def getGeometryOutput(derivation, elementNode): "Get vector3 vertexes from attribute dictionary." if derivation == None: derivation = CircleDerivation(elementNode) angleTotal = math.radians(derivation.start) loop = [] sidesCeiling = int(math.ceil(abs(derivation.sides) * derivation.extent / 360.0)) sideAngle = math.radians(derivation.extent) / sidesCeiling if derivation.sides < 0.0: sideAngle = -sideAngle spiral = lineation.Spiral(derivation.spiral, 0.5 * sideAngle / math.pi) for side in xrange(sidesCeiling + 1): unitPolar = euclidean.getWiddershinsUnitPolar(angleTotal) x = unitPolar.real * derivation.radiusArealized.real y = unitPolar.imag * derivation.radiusArealized.imag vertex = spiral.getSpiralPoint(unitPolar, Vector3(x, y)) angleTotal += sideAngle loop.append(vertex) radiusMaximum = 0.000001 * max(derivation.radiusArealized.real, derivation.radiusArealized.imag) loop = euclidean.getLoopWithoutCloseEnds(radiusMaximum, loop) lineation.setClosedAttribute(elementNode, derivation.revolutions) return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(loop, sideAngle))