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.Vertex(*args, **kwargs)

Bases: geomdl.elements.AbstractEntity

3-dimensional Vertex entity with spatial and parametric position.

data

(x,y,z) components of the vertex.

Getter:Gets the 3-dimensional components
Setter:Sets the 3-dimensional components
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
inside

Inside-outside flag

Getter:Gets the flag
Setter:Sets the flag
Type:bool
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
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property 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 opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
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
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
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
x

x-component of the vertex

Getter:Gets the x-component of the vertex
Setter:Sets the x-component of the vertex
Type:float
y

y-component of the vertex

Getter:Gets the y-component of the vertex
Setter:Sets the y-component of the vertex
Type:float
z

z-component of the vertex

Getter:Gets the z-component of the vertex
Setter:Sets the z-component of the vertex
Type:float
class geomdl.elements.Triangle(*args, **kwargs)

Bases: geomdl.elements.AbstractEntity

Triangle entity which represents a triangle composed of vertices.

A Triangle entity stores the vertices in its data structure. data returns the vertex IDs and vertices return the Vertex instances 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.

data

Vertices composing the triangular structure.

Getter:Gets the vertex indices (as int values)
Setter:Sets the vertices (as Vertex objects)
edges

Edges of the triangle

Getter:Gets the list of vertices that generates the edges of the triangle
Type:list
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
inside

Inside-outside flag

Getter:Gets the flag
Setter:Sets the flag
Type:bool
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
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property 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 opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
vertex_ids

Vertex indices

Note

Please use data instead of this property.

Getter:Gets the vertex indices
Type:list
vertices

Vertices of the triangle

Getter:Gets the list of vertices
Type:tuple
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.Quad(*args, **kwargs)

Bases: geomdl.elements.AbstractEntity

Quad entity which represents a quadrilateral structure composed of vertices.

A Quad entity stores the vertices in its data structure. data returns the vertex IDs and vertices return the Vertex instances 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.

data

Vertices composing the quadrilateral structure.

Getter:Gets the vertex indices (as int values)
Setter:Sets the vertices (as Vertex objects)
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
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
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property 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 opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
vertices

Vertices composing the quadrilateral structure.

Getter:Gets the vertices
class geomdl.elements.Face(*args, **kwargs)

Bases: geomdl.elements.AbstractEntity

Representation 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.

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
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
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property 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 opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
triangles

Triangles of the face

Getter:Gets the list of triangles
Type:tuple
class geomdl.elements.Body(*args, **kwargs)

Bases: geomdl.elements.AbstractEntity

Representation 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.

faces

Faces of the body

Getter:Gets the list of faces
Type:tuple
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
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
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property 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 opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.