コード例 #1
0
ファイル: circle.py プロジェクト: lozaloza/asimov
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))
コード例 #2
0
ファイル: square.py プロジェクト: folksjos/RepG
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)
コード例 #3
0
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))
コード例 #4
0
ファイル: square.py プロジェクト: mccoyn/SkeinFactory
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)
コード例 #5
0
ファイル: circle.py プロジェクト: CNCBASHER/skeinforge-1
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)
コード例 #6
0
ファイル: circle.py プロジェクト: lImbus/giseburt-ReplicatorG
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)
コード例 #7
0
ファイル: polygon.py プロジェクト: folksjos/RepG
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))
コード例 #8
0
ファイル: polygon.py プロジェクト: maestroflema/asimov
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))
コード例 #9
0
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)
コード例 #10
0
ファイル: circle.py プロジェクト: greenarrow/skeinforgeGit
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)
コード例 #11
0
ファイル: polygon.py プロジェクト: mccoyn/SkeinFactory
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)
コード例 #12
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)
コード例 #13
0
ファイル: square.py プロジェクト: lImbus/giseburt-ReplicatorG
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)
コード例 #14
0
ファイル: circle.py プロジェクト: 1060460048/Cura
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))