Ejemplo n.º 1
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], self.inradius, xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         self.packingDensity, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', self.radius, xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedIntDefault(self.seed, 'seed',
                                                 xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey(
             'target', xmlElement)
     self.typeString = evaluate.getEvaluatedStringDefault(
         self.typeString, 'type', xmlElement)
     self.zigzag = evaluate.getEvaluatedBooleanDefault(
         self.zigzag, 'zigzag', xmlElement)
Ejemplo n.º 2
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'elementRadius', 'elementDiameter', complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', self.radius)
		self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', elementNode, 'type')
		self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
Ejemplo n.º 3
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(0.2, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedInt(None, 'seed', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
Ejemplo n.º 4
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], self.inradius, xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(self.packingDensity, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', self.radius, xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedIntDefault(self.seed, 'seed', xmlElement)
		if len(self.target) < 1:
			self.target = evaluate.getTransformedPathsByKey('target', xmlElement)
		self.typeString = evaluate.getEvaluatedStringDefault(self.typeString, 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBooleanDefault(self.zigzag, 'zigzag', xmlElement)
Ejemplo n.º 5
0
 def __init__(self, elementNode):
     "Set defaults."
     self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "demiwidth", "width", self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, "demiheight", "height", self.inradius.imag)
     self.density = evaluate.getEvaluatedFloat(0.2, elementNode, "density")
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, "elementRadius", "elementDiameter", complex(1.0, 1.0)
     )
     self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, "radius", "diameter", self.radius)
     self.seed = evaluate.getEvaluatedInt(None, elementNode, "seed")
     self.target = evaluate.getTransformedPathsByKey([], elementNode, "target")
     self.typeMenuRadioStrings = "hexagonal random rectangular".split()
     self.typeString = evaluate.getEvaluatedString("rectangular", elementNode, "type")
     self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, "zigzag")
Ejemplo n.º 6
0
 def __init__(self, elementNode):
     'Set defaults.'
     self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'demiwidth', 'width', self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'demiheight', 'height', self.inradius.imag)
     self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, 'elementRadius', 'elementDiameter', complex(1.0, 1.0))
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', self.radius)
     self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
     self.target = evaluate.getTransformedPathsByKey([], elementNode,
                                                     'target')
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedString('rectangular',
                                                   elementNode, 'type')
     self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
Ejemplo n.º 7
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         0.2, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedInt(None, 'seed', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedString('rectangular', 'type',
                                                   xmlElement)
     self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
Ejemplo n.º 8
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(5.0, 5.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)
	radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
	radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', radius, xmlElement)
	diameter = radius + radius
	typeString = evaluate.getEvaluatedStringDefault('rectangular', 'type', xmlElement)
	typeStringTwoCharacters = typeString.lower()[: 2]
	typeStringFirstCharacter = typeStringTwoCharacters[: 1]
	zigzag = evaluate.getEvaluatedBooleanDefault(True, 'zigzag', xmlElement)
	topRight = complex(demiwidth, demiheight)
	bottomLeft = -topRight
	loopsComplex = [euclidean.getSquareLoopWiddershins(bottomLeft, topRight)]
	paths = evaluate.getTransformedPathsByKey('target', xmlElement)
	if len(paths) > 0:
		loopsComplex = euclidean.getComplexPaths(paths)
	maximumComplex = euclidean.getMaximumByPathsComplex(loopsComplex)
	minimumComplex = euclidean.getMinimumByPathsComplex(loopsComplex)
	gridPath = None
	if typeStringTwoCharacters == 'he':
		gridPath = getHexagonalGrid(diameter, loopsComplex, maximumComplex, minimumComplex, zigzag)
	elif typeStringTwoCharacters == 'ra' or typeStringFirstCharacter == 'a':
		gridPath = getRandomGrid(diameter, loopsComplex, maximumComplex, minimumComplex, xmlElement)
	elif typeStringTwoCharacters == 're' or typeStringFirstCharacter == 'e':
		gridPath = getRectangularGrid(diameter, loopsComplex, maximumComplex, minimumComplex, zigzag)
	if gridPath == None:
		print('Warning, the step type was not one of (hexagonal, random or rectangular) in getGeometryOutput in grid for:')
		print(typeString)
		print(xmlElement)
		return []
	loop = euclidean.getVector3Path(gridPath)
	xmlElement.attributeDictionary['closed'] = 'false'
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)