HalfEdge

class compas.datastructures.HalfEdge[source]

Bases: Datastructure

Base half-edge data structure for representing the topology of open oor closed surface meshes.

Parameters:
default_vertex_attributes: dict, optional

Default values for vertex attributes.

default_edge_attributes: dict, optional

Default values for edge attributes.

default_face_attributes: dict, optional

Default values for face attributes.

**kwargsdict, optional

Additional attributes to add to the data structure.

Attributes:
attributesdict[str, Any]

General attributes of the data structure that are included in the data representation and serialization.

default_vertex_attributesdict[str, Any]

Dictionary containing default values for the attributes of vertices. It is recommended to add a default to this dictionary using update_default_vertex_attributes() for every vertex attribute used in the data structure.

default_edge_attributesdict[str, Any]

Dictionary containing default values for the attributes of edges. It is recommended to add a default to this dictionary using update_default_edge_attributes() for every edge attribute used in the data structure.

default_face_attributesdict[str, Any]

Dictionary contnaining default values for the attributes of faces. It is recommended to add a default to this dictionary using update_default_face_attributes() for every face attribute used in the data structure.

Methods

add_face

Add a face to the mesh object.

add_vertex

Add a vertex to the mesh object.

clear

Clear all the mesh data.

cull_vertices

Remove all unused vertices from the mesh object.

delete_face

Delete a face from the mesh object.

delete_vertex

Delete a vertex from the mesh and everything that is attached to it.

edge_attribute

Get or set an attribute of an edge.

edge_attributes

Get or set multiple attributes of an edge.

edge_faces

Find the two faces adjacent to an edge.

edge_loop

Find all edges on the same loop as a given edge.

edge_sample

A random sample of the edges.

edge_strip

Find all edges on the same strip as a given edge.

edges

Iterate over the edges of the mesh.

edges_attribute

Get or set an attribute of multiple edges.

edges_attributes

Get or set multiple attributes of multiple edges.

edges_where

Get edges for which a certain condition or set of conditions is true.

edges_where_predicate

Get edges for which a certain condition or set of conditions is true using a lambda function.

euler

Calculate the Euler characteristic.

face_adjacency_halfedge

Find one half-edge over which two faces are adjacent.

face_adjacency_vertices

Find all vertices over which two faces are adjacent.

face_attribute

Get or set an attribute of a face.

face_attributes

Get or set multiple attributes of a face.

face_corners

Return triplets of face vertices forming the corners of the face.

face_degree

Count the neighbors of a face.

face_halfedges

The halfedges of a face.

face_max_degree

Compute the maximum degree of all faces.

face_min_degree

Compute the minimum degree of all faces.

face_neighborhood

Return the faces in the neighborhood of a face.

face_neighbors

Return the neighbors of a face across its edges.

face_sample

A random sample of the faces.

face_vertex_after

Return the n-th vertex after the specified vertex in a specific face.

face_vertex_ancestor

Return the n-th vertex before the specified vertex in a specific face.

face_vertex_before

Return the n-th vertex before the specified vertex in a specific face.

face_vertex_descendant

Return the n-th vertex after the specified vertex in a specific face.

face_vertices

The vertices of a face.

faces

Iterate over the faces of the mesh.

faces_attribute

Get or set an attribute of multiple faces.

faces_attributes

Get or set multiple attributes of multiple faces.

faces_where

Get faces for which a certain condition or set of conditions is true.

faces_where_predicate

Get faces for which a certain condition or set of conditions is true using a lambda function.

from_data

Construct an object of this type from the provided data.

halfedge_after

Find the halfedge after the given halfedge in the same face.

halfedge_before

Find the halfedge before the given halfedge in the same face.

halfedge_face

Find the face corresponding to a halfedge.

halfedge_loop

Find all edges on the same loop as the halfedge, in the direction of the halfedge.

halfedge_loop_vertices

Find all vertices on the same loop as a given halfedge.

halfedge_strip

Find all edges on the same strip as a given halfedge.

halfedge_strip_faces

Find all faces on the same strip as a given halfedge.

has_edge

Verify that the mesh contains a specific edge.

has_face

Verify that a face is part of the mesh.

has_halfedge

Verify that a halfedge is part of the mesh.

has_vertex

Verify that a vertex is in the mesh.

index_vertex

Returns a dictionary that maps the indices of a vertex list to the corresponding vertex identifiers.

is_closed

Verify that the mesh is closed.

is_edge_on_boundary

Verify that an edge is on the boundary.

is_empty

Verify that the mesh is empty.

is_face_on_boundary

Verify that a face is on a boundary.

is_manifold

Verify that the mesh is manifold.

is_orientable

Verify that the mesh is orientable.

is_quadmesh

Verify that the mesh consists of only quads.

is_regular

Verify that the mesh is regular.

is_trimesh

Verify that the mesh consists of only triangles.

is_valid

Verify that the mesh is valid.

is_vertex_connected

Verify that a vertex is connected.

is_vertex_on_boundary

Verify that a vertex is on a boundary.

number_of_edges

Count the number of edges in the mesh.

number_of_faces

Count the number of faces in the mesh.

number_of_vertices

Count the number of vertices in the mesh.

remove_unused_vertices

Remove all unused vertices from the mesh object.

summary

Print a summary of the mesh.

unset_edge_attribute

Unset the attribute of an edge.

unset_face_attribute

Unset the attribute of a face.

unset_vertex_attribute

Unset the attribute of a vertex.

update_default_edge_attributes

Update the default edge attributes.

update_default_face_attributes

Update the default face attributes.

update_default_vertex_attributes

Update the default vertex attributes.

vertex_attribute

Get or set an attribute of a vertex.

vertex_attributes

Get or set multiple attributes of a vertex.

vertex_degree

Count the neighbors of a vertex.

vertex_edges

Find all edges connected to a given vertex.

vertex_faces

The faces connected to a vertex.

vertex_index

Returns a dictionary that maps vertex identifiers to the corresponding index in a vertex list or array.

vertex_max_degree

Compute the maximum degree of all vertices.

vertex_min_degree

Compute the minimum degree of all vertices.

vertex_neighborhood

Return the vertices in the neighborhood of a vertex.

vertex_neighbors

Return the neighbors of a vertex.

vertex_sample

A random sample of the vertices.

vertices

Iterate over the vertices of the mesh.

vertices_attribute

Get or set an attribute of multiple vertices.

vertices_attributes

Get or set multiple attributes of multiple vertices.

vertices_where

Get vertices for which a certain condition or set of conditions is true.

vertices_where_predicate

Get vertices for which a certain condition or set of conditions is true using a lambda function.

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_data

Convert an object to its native data representation.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

validate_data

Validate the data against the object's data schema.