def setToXMLElement(self, xmlElement): "Set to the xmlElement." self.sides = evaluate.getEvaluatedFloatDefault(self.sides, 'sides', xmlElement) self.sideAngle = 2.0 * math.pi / self.sides self.radius = lineation.getComplexByMultiplierPrefixes( math.cos(0.5 * self.sideAngle), ['apothem', 'inradius'], self.radius, xmlElement) self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement) self.radius = lineation.getComplexByMultiplierPrefixes( 2.0, ['diameter', 'size'], self.radius, xmlElement) self.sidesCeiling = int(math.ceil(abs(self.sides))) self.start = evaluate.getEvaluatedIntDefault(self.start, 'start', xmlElement) self.start = lineation.getWrappedInteger(self.start, 360.0) self.extent = evaluate.getEvaluatedIntDefault( self.sidesCeiling - self.start, 'extent', xmlElement) self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent, 'end', xmlElement) self.end = lineation.getWrappedInteger(self.end, self.sidesCeiling) self.revolutions = evaluate.getEvaluatedIntDefault( self.revolutions, 'revolutions', xmlElement) if self.revolutions > 1: self.end += self.sidesCeiling * (self.revolutions - 1) self.spiral = evaluate.getVector3ByPrefix(self.spiral, 'spiral', xmlElement)
def __init__(self, modulo, prefix, xmlElement): "Initialize." self.start = evaluate.getEvaluatedIntDefault(0, prefix + 'start', xmlElement) self.start = lineation.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 = lineation.getWrappedInteger(self.end, modulo) self.revolutions = evaluate.getEvaluatedIntDefault(1, prefix + 'revolutions', xmlElement) if self.revolutions > 1: self.end += modulo * (self.revolutions - 1)
def __init__(self, modulo, prefix, xmlElement): "Initialize." self.start = evaluate.getEvaluatedIntDefault(0, prefix + 'start', xmlElement) self.start = lineation.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 = lineation.getWrappedInteger(self.end, modulo) self.revolutions = evaluate.getEvaluatedIntDefault( 1, prefix + 'revolutions', xmlElement) if self.revolutions > 1: self.end += modulo * (self.revolutions - 1)
def setToXMLElement(self, xmlElement): "Set to the xmlElement." self.sides = evaluate.getEvaluatedFloatDefault(self.sides, 'sides', xmlElement) self.sideAngle = 2.0 * math.pi / self.sides self.radius = lineation.getComplexByMultiplierPrefixes(math.cos(0.5 * self.sideAngle), ['apothem', 'inradius'], self.radius, xmlElement) self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement) self.radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], self.radius, xmlElement) self.sidesCeiling = int(math.ceil(abs(self.sides))) self.start = evaluate.getEvaluatedIntDefault(self.start, 'start', xmlElement) self.start = lineation.getWrappedInteger(self.start, 360.0) self.extent = evaluate.getEvaluatedIntDefault(self.sidesCeiling - self.start, 'extent', xmlElement) self.end = evaluate.getEvaluatedIntDefault(self.start + self.extent, 'end', xmlElement) self.end = lineation.getWrappedInteger(self.end, self.sidesCeiling) self.revolutions = evaluate.getEvaluatedIntDefault(self.revolutions, 'revolutions', xmlElement) if self.revolutions > 1: self.end += self.sidesCeiling * (self.revolutions - 1) self.spiral = evaluate.getVector3ByPrefix('spiral', self.spiral, xmlElement)
def __init__(self, xmlElement): 'Set defaults.' self.sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement) self.sideAngle = 2.0 * math.pi / self.sides cosSide = math.cos(0.5 * self.sideAngle) self.radius = lineation.getComplexByMultiplierPrefixes(cosSide, ['apothem', 'inradius'], complex(1.0, 1.0), xmlElement) self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement) self.radius = lineation.getComplexByMultiplierPrefixes(2.0, ['diameter', 'size'], self.radius, xmlElement) self.sidesCeiling = int(math.ceil(abs(self.sides))) self.start = evaluate.getEvaluatedIntDefault(0, 'start', xmlElement) self.start = lineation.getWrappedInteger(self.start, 360.0) end = evaluate.getEvaluatedIntDefault(self.sidesCeiling, 'end', xmlElement) end = lineation.getWrappedInteger(end, self.sidesCeiling) self.revolutions = evaluate.getEvaluatedIntDefault(1, 'revolutions', xmlElement) self.extent = evaluate.getEvaluatedIntDefault(end - self.start, 'extent', xmlElement) self.extent += self.sidesCeiling * (self.revolutions - 1) self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
def __init__(self, xmlElement): 'Set defaults.' self.sides = evaluate.getEvaluatedFloatDefault(4.0, 'sides', xmlElement) self.sideAngle = 2.0 * math.pi / self.sides cosSide = math.cos(0.5 * self.sideAngle) self.radius = lineation.getComplexByMultiplierPrefixes( cosSide, ['apothem', 'inradius'], complex(1.0, 1.0), xmlElement) self.radius = lineation.getComplexByPrefixes(['demisize', 'radius'], self.radius, xmlElement) self.radius = lineation.getComplexByMultiplierPrefixes( 2.0, ['diameter', 'size'], self.radius, xmlElement) self.sidesCeiling = int(math.ceil(abs(self.sides))) self.start = evaluate.getEvaluatedIntDefault(0, 'start', xmlElement) self.start = lineation.getWrappedInteger(self.start, 360.0) end = evaluate.getEvaluatedIntDefault(self.sidesCeiling, 'end', xmlElement) end = lineation.getWrappedInteger(end, self.sidesCeiling) self.revolutions = evaluate.getEvaluatedIntDefault( 1, 'revolutions', xmlElement) self.extent = evaluate.getEvaluatedIntDefault(end - self.start, 'extent', xmlElement) self.extent += self.sidesCeiling * (self.revolutions - 1) self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)