2 Vertex of a triangle mesh.
6 from __future__ import absolute_import
7 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
10 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
11 from fabmetheus_utilities import xml_simple_reader
14 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
15 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
16 __date__ = '$Date: 2008/02/05 $'
17 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
20 def addGeometryList(elementNode, vertexes):
21 "Add vertex elements to an xml element."
22 for vertex in vertexes:
23 vertexElement = getUnboundVertexElement(vertex)
24 vertexElement.parentNode = elementNode
25 elementNode.childNodes.append( vertexElement )
27 def addVertexToAttributes(attributes, vertex):
28 "Add to the attribute dictionary."
30 attributes['x'] = str(vertex.x)
32 attributes['y'] = str(vertex.y)
34 attributes['z'] = str(vertex.z)
36 def getUnboundVertexElement(vertex):
37 "Add vertex element to an xml element."
38 vertexElement = xml_simple_reader.ElementNode()
39 addVertexToAttributes(vertexElement.attributes, vertex)
40 vertexElement.localName = 'vertex'
43 def processElementNode(elementNode):
44 "Process the xml element."
45 elementNode.parentNode.xmlObject.vertexes.append(evaluate.getVector3FromElementNode(elementNode))