collada.geometry.Geometry¶
-
class
collada.geometry.Geometry(collada, id, name, sourcebyid, primitives=None, xmlnode=None, double_sided=False)¶ Bases:
collada.common.DaeObjectA class containing the data coming from a COLLADA <geometry> tag

-
__init__(collada, id, name, sourcebyid, primitives=None, xmlnode=None, double_sided=False)¶ Create a geometry instance
Parameters: - collada (collada.Collada) – The collada object this geometry belongs to
- id (str) – A unique string identifier for the geometry
- name (str) – A text string naming the geometry
- sourcebyid – A list of
collada.source.Sourceobjects or a dictionary mapping source ids to the actual objects - primitives (list) – List of primitive objects contained within the geometry.
Do not set this argument manually. Instead, create a
collada.geometry.Geometryfirst and then append toprimitiveswith the create* functions. - xmlnode – When loaded, the xmlnode it comes from.
- double_sided (bool) – Whether or not the geometry should be rendered double sided
Methods
__init__(collada, id, name, sourcebyid[, …])Create a geometry instance bind(matrix, materialnodebysymbol)Binds this geometry to a transform matrix and material mapping. createLineSet(indices, inputlist, materialid)Create a set of lines for use in this geometry instance. createPolylist(indices, vcounts, inputlist, …)Create a polylist for use with this geometry instance. createPolygons(indices, inputlist, materialid)Create a polygons for use with this geometry instance. createTriangleSet(indices, inputlist, materialid)Create a set of triangles for use in this geometry instance. load(collada, localscope, node)Load and return a class instance from an XML node. save()Saves the geometry back to xmlnode-
collada= None¶ The
collada.Colladaobject this geometry belongs to
-
id= None¶ The unique string identifier for the geometry
-
name= None¶ The text string naming the geometry
-
double_sided= None¶ A boolean indicating whether or not the geometry should be rendered double sided
-
sourceById= None¶ A dictionary containing
collada.source.Sourceobjects indexed by their id.
-
primitives= None¶ List of primitives (base type
collada.primitive.Primitive) inside this geometry.
-
xmlnode= None¶ ElementTree representation of the geometry.
-
createLineSet(indices, inputlist, materialid)¶ Create a set of lines for use in this geometry instance.
Parameters: - indices (numpy.array) – unshaped numpy array that contains the indices for the inputs referenced in inputlist
- inputlist (collada.source.InputList) – The inputs for this primitive
- materialid (str) – A string containing a symbol that will get used to bind this lineset to a material when instantiating into a scene
Return type:
-
createTriangleSet(indices, inputlist, materialid)¶ Create a set of triangles for use in this geometry instance.
Parameters: - indices (numpy.array) – unshaped numpy array that contains the indices for the inputs referenced in inputlist
- inputlist (collada.source.InputList) – The inputs for this primitive
- materialid (str) – A string containing a symbol that will get used to bind this triangleset to a material when instantiating into a scene
Return type:
-
createPolylist(indices, vcounts, inputlist, materialid)¶ Create a polylist for use with this geometry instance.
Parameters: - indices (numpy.array) – unshaped numpy array that contains the indices for the inputs referenced in inputlist
- vcounts (numpy.array) – unshaped numpy array that contains the vertex count for each polygon in this polylist
- inputlist (collada.source.InputList) – The inputs for this primitive
- materialid (str) – A string containing a symbol that will get used to bind this polylist to a material when instantiating into a scene
Return type:
-
createPolygons(indices, inputlist, materialid)¶ Create a polygons for use with this geometry instance.
Parameters: - indices (numpy.array) – list of unshaped numpy arrays that each contain the indices for a single polygon
- inputlist (collada.source.InputList) – The inputs for this primitive
- materialid (str) – A string containing a symbol that will get used to bind this polygons to a material when instantiating into a scene
Return type:
-
static
load(collada, localscope, node)¶ Load and return a class instance from an XML node.
Inspect the data inside node, which must match this class tag and create an instance out of it.
Parameters: - collada (collada.Collada) – The collada file object where this object lives
- localscope (dict) – If there is a local scope where we should look for local ids (sid) this is the dictionary. Otherwise empty dict ({})
- node – An Element from python’s ElementTree API
-
bind(matrix, materialnodebysymbol)¶ Binds this geometry to a transform matrix and material mapping. The geometry’s points get transformed by the given matrix and its inputs get mapped to the given materials.
Parameters: - matrix (numpy.array) – A 4x4 numpy float matrix
- materialnodebysymbol (dict) – A dictionary with the material symbols inside the primitive
assigned to
collada.scene.MaterialNodedefined in the scene
Return type:
-