Geometric Entities
The geometric entities are used for advanced algorithms, such as tessellation. The AbstractEntity class
provides the abstract base for all geometric and topological entities.
This module provides the following geometric and topological entities:
Class Reference
- class geomdl.elements.Body(*args, **kwargs)
Bases:
AbstractEntityRepresentation of Body entity which is composed of faces.
- add_face(*args)
Adds faces to the Body object.
This method takes a single or a list of faces as its function arguments.
- property faces
Faces of the body
- Getter:
Gets the list of faces
- Type:
tuple
- property id
Object ID (as an integer).
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object ID
- Setter:
Sets the object ID
- Type:
int
- property name
Object name (as a string)
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object name
- Setter:
Sets the object name
- Type:
str
- property opt
Dictionary for storing custom data in the current geometry object.
optis a wrapper to a dict in key => value format, where key is string, value is any Python object. You can useoptproperty to store custom data inside the geometry object. For instance:geom.opt = ["face_id", 4] # creates "face_id" key and sets its value to an integer geom.opt = ["contents", "data values"] # creates "face_id" key and sets its value to a string print(geom.opt) # will print: {'face_id': 4, 'contents': 'data values'} del geom.opt # deletes the contents of the hash map print(geom.opt) # will print: {} geom.opt = ["body_id", 1] # creates "body_id" key and sets its value to 1 geom.opt = ["body_id", 12] # changes the value of "body_id" to 12 print(geom.opt) # will print: {'body_id': 12} geom.opt = ["body_id", None] # deletes "body_id" print(geom.opt) # will print: {}
- Getter:
Gets the dict
- Setter:
Adds key and value pair to the dict
- Deleter:
Deletes the contents of the dict
- class geomdl.elements.Face(*args, **kwargs)
Bases:
AbstractEntityRepresentation of Face entity which is composed of triangles or quads.
- add_triangle(*args)
Adds triangles to the Face object.
This method takes a single or a list of triangles as its function arguments.
- property id
Object ID (as an integer).
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object ID
- Setter:
Sets the object ID
- Type:
int
- property name
Object name (as a string)
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object name
- Setter:
Sets the object name
- Type:
str
- property opt
Dictionary for storing custom data in the current geometry object.
optis a wrapper to a dict in key => value format, where key is string, value is any Python object. You can useoptproperty to store custom data inside the geometry object. For instance:geom.opt = ["face_id", 4] # creates "face_id" key and sets its value to an integer geom.opt = ["contents", "data values"] # creates "face_id" key and sets its value to a string print(geom.opt) # will print: {'face_id': 4, 'contents': 'data values'} del geom.opt # deletes the contents of the hash map print(geom.opt) # will print: {} geom.opt = ["body_id", 1] # creates "body_id" key and sets its value to 1 geom.opt = ["body_id", 12] # changes the value of "body_id" to 12 print(geom.opt) # will print: {'body_id': 12} geom.opt = ["body_id", None] # deletes "body_id" print(geom.opt) # will print: {}
- Getter:
Gets the dict
- Setter:
Adds key and value pair to the dict
- Deleter:
Deletes the contents of the dict
- opt_get(value)
Safely query for the value from the
optproperty.- Parameters:
value (str) – a key in the
optproperty- Returns:
the corresponding value, if the key exists.
None, otherwise.
- property triangles
Triangles of the face
- Getter:
Gets the list of triangles
- Type:
tuple
- class geomdl.elements.Quad(*args, **kwargs)
Bases:
AbstractEntityQuad entity which represents a quadrilateral structure composed of vertices.
A Quad entity stores the vertices in its data structure.
datareturns the vertex IDs andverticesreturn theVertexinstances that compose the quadrilateral structure.- add_vertex(*args)
Adds vertices to the Quad object.
This method takes a single or a list of vertices as its function arguments.
- property data
Vertices composing the quadrilateral structure.
- Getter:
Gets the vertex indices (as int values)
- Setter:
Sets the vertices (as Vertex objects)
- property id
Object ID (as an integer).
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object ID
- Setter:
Sets the object ID
- Type:
int
- property name
Object name (as a string)
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object name
- Setter:
Sets the object name
- Type:
str
- property opt
Dictionary for storing custom data in the current geometry object.
optis a wrapper to a dict in key => value format, where key is string, value is any Python object. You can useoptproperty to store custom data inside the geometry object. For instance:geom.opt = ["face_id", 4] # creates "face_id" key and sets its value to an integer geom.opt = ["contents", "data values"] # creates "face_id" key and sets its value to a string print(geom.opt) # will print: {'face_id': 4, 'contents': 'data values'} del geom.opt # deletes the contents of the hash map print(geom.opt) # will print: {} geom.opt = ["body_id", 1] # creates "body_id" key and sets its value to 1 geom.opt = ["body_id", 12] # changes the value of "body_id" to 12 print(geom.opt) # will print: {'body_id': 12} geom.opt = ["body_id", None] # deletes "body_id" print(geom.opt) # will print: {}
- Getter:
Gets the dict
- Setter:
Adds key and value pair to the dict
- Deleter:
Deletes the contents of the dict
- opt_get(value)
Safely query for the value from the
optproperty.- Parameters:
value (str) – a key in the
optproperty- Returns:
the corresponding value, if the key exists.
None, otherwise.
- property vertices
Vertices composing the quadrilateral structure.
- Getter:
Gets the vertices
- class geomdl.elements.Triangle(*args, **kwargs)
Bases:
AbstractEntityTriangle entity which represents a triangle composed of vertices.
A Triangle entity stores the vertices in its data structure.
datareturns the vertex IDs andverticesreturn theVertexinstances that compose the triangular structure.- add_vertex(*args)
Adds vertices to the Triangle object.
This method takes a single or a list of vertices as its function arguments.
- property data
Vertices composing the triangular structure.
- Getter:
Gets the vertex indices (as int values)
- Setter:
Sets the vertices (as Vertex objects)
- property edges
Edges of the triangle
- Getter:
Gets the list of vertices that generates the edges of the triangle
- Type:
list
- property id
Object ID (as an integer).
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object ID
- Setter:
Sets the object ID
- Type:
int
- property inside
Inside-outside flag
- Getter:
Gets the flag
- Setter:
Sets the flag
- Type:
bool
- property name
Object name (as a string)
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object name
- Setter:
Sets the object name
- Type:
str
- property opt
Dictionary for storing custom data in the current geometry object.
optis a wrapper to a dict in key => value format, where key is string, value is any Python object. You can useoptproperty to store custom data inside the geometry object. For instance:geom.opt = ["face_id", 4] # creates "face_id" key and sets its value to an integer geom.opt = ["contents", "data values"] # creates "face_id" key and sets its value to a string print(geom.opt) # will print: {'face_id': 4, 'contents': 'data values'} del geom.opt # deletes the contents of the hash map print(geom.opt) # will print: {} geom.opt = ["body_id", 1] # creates "body_id" key and sets its value to 1 geom.opt = ["body_id", 12] # changes the value of "body_id" to 12 print(geom.opt) # will print: {'body_id': 12} geom.opt = ["body_id", None] # deletes "body_id" print(geom.opt) # will print: {}
- Getter:
Gets the dict
- Setter:
Adds key and value pair to the dict
- Deleter:
Deletes the contents of the dict
- opt_get(value)
Safely query for the value from the
optproperty.- Parameters:
value (str) – a key in the
optproperty- Returns:
the corresponding value, if the key exists.
None, otherwise.
- property vertex_ids
Vertex indices
Note
Please use
datainstead of this property.- Getter:
Gets the vertex indices
- Type:
list
- property vertices
Vertices of the triangle
- Getter:
Gets the list of vertices
- Type:
tuple
- property vertices_closed
Vertices which generates a closed triangle
Adds the first vertex as a last element of the return value (good for plotting)
- Getter:
Gets the list of vertices
- Type:
list
- class geomdl.elements.Vertex(*args, **kwargs)
Bases:
AbstractEntity3-dimensional Vertex entity with spatial and parametric position.
- property data
(x,y,z) components of the vertex.
- Getter:
Gets the 3-dimensional components
- Setter:
Sets the 3-dimensional components
- property id
Object ID (as an integer).
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object ID
- Setter:
Sets the object ID
- Type:
int
- property inside
Inside-outside flag
- Getter:
Gets the flag
- Setter:
Sets the flag
- Type:
bool
- property name
Object name (as a string)
Please refer to the wiki for details on using this class member.
- Getter:
Gets the object name
- Setter:
Sets the object name
- Type:
str
- property opt
Dictionary for storing custom data in the current geometry object.
optis a wrapper to a dict in key => value format, where key is string, value is any Python object. You can useoptproperty to store custom data inside the geometry object. For instance:geom.opt = ["face_id", 4] # creates "face_id" key and sets its value to an integer geom.opt = ["contents", "data values"] # creates "face_id" key and sets its value to a string print(geom.opt) # will print: {'face_id': 4, 'contents': 'data values'} del geom.opt # deletes the contents of the hash map print(geom.opt) # will print: {} geom.opt = ["body_id", 1] # creates "body_id" key and sets its value to 1 geom.opt = ["body_id", 12] # changes the value of "body_id" to 12 print(geom.opt) # will print: {'body_id': 12} geom.opt = ["body_id", None] # deletes "body_id" print(geom.opt) # will print: {}
- Getter:
Gets the dict
- Setter:
Adds key and value pair to the dict
- Deleter:
Deletes the contents of the dict
- opt_get(value)
Safely query for the value from the
optproperty.- Parameters:
value (str) – a key in the
optproperty- Returns:
the corresponding value, if the key exists.
None, otherwise.
- property u
Parametric u-component of the vertex
- Getter:
Gets the u-component of the vertex
- Setter:
Sets the u-component of the vertex
- Type:
float
- property uv
Parametric (u,v) pair of the vertex
- Getter:
Gets the uv-component of the vertex
- Setter:
Sets the uv-component of the vertex
- Type:
list, tuple
- property v
Parametric v-component of the vertex
- Getter:
Gets the v-component of the vertex
- Setter:
Sets the v-component of the vertex
- Type:
float
- property x
x-component of the vertex
- Getter:
Gets the x-component of the vertex
- Setter:
Sets the x-component of the vertex
- Type:
float
- property y
y-component of the vertex
- Getter:
Gets the y-component of the vertex
- Setter:
Sets the y-component of the vertex
- Type:
float
- property z
z-component of the vertex
- Getter:
Gets the z-component of the vertex
- Setter:
Sets the z-component of the vertex
- Type:
float