ddg.datastructures.halfedge package
Submodules
- ddg.datastructures.halfedge.copy module
- ddg.datastructures.halfedge.delaunay module
calculate_angle()opp_halfangle_tan()opp_angle_cot()euclidean_cotan_weight()evaluate_cotan_weight()is_delaunay()update_edgelength()intrinsic_lengthfunction()extrinsic_lengthfunction()flip()delaunay_flip_algorithm()update_crossings()init_crossings_attr()init_overlay_structure()SurfaceWithOverlayadd_parser()execute_flip_algo()
- ddg.datastructures.halfedge.get module
in_edges()out_edges()get_edge_loop()count_edges_in_loop()get_opposite_edge_in_face()get_opposite_edge_at_head()get_length_from_co()get_vertices()get_edges()get_number_of_edges()complement()get_vertex()get_edge()get_face()is_triangulation()is_connected()single_edges()boundary_vertices()boundary_edges()interior_vertices()interior_edges()is_boundary_vertex()is_boundary_edge()
- ddg.datastructures.halfedge.grid module
- ddg.datastructures.halfedge.io module
- ddg.datastructures.halfedge.math module
- ddg.datastructures.halfedge.modify module
- ddg.datastructures.halfedge.set module
- ddg.datastructures.halfedge.surface module
- ddg.datastructures.halfedge.surface_generator module
Module contents
- class ddg.datastructures.halfedge.Surface[source]
Bases:
objectFinite cell decomposition of a 2-dimensional manifold, possibly with boundary, represented by a half edge data structure.
- add_edge(v1, v2, epre=None, enex=None)[source]
Insert an edge between two boundary vertices.
- Parameters:
- v1, v2vertex
Boundary vertices that the edge should connect.
- epreedge or None (default=None)
Defines the edge such that epre.nex is the first new edge. If this is None, a boundary edge pointing to v will be looked up.
- Returns:
- edge
The halfedge from v1 to v2.
- add_face(n, v=[])[source]
Adds an n-gon to the surface. The polygon is not connected to any other polygons after addition.
- Parameters:
- nint
number of vertices of the polygon to be added
- vlist
vertices that become vertices of the polygon new vertices are generated if there are non given
- Returns:
- face
the face that has been added
- glue(e1, e2)[source]
Glues edges of the same surface such that the given halfedges form the new shared edge.
The given halfedges
e1ande2will be preserved and become opposites of each other while their former opposites are eliminated. The vertices of the new halfedge pair will be the original head and tail of the first edgee1, except in the following special case: If the second edgee2is a loop and the first edgee1is not a loop, then the gluing operation identifies the original tail ofe1with the head ofe1and the original tail ofe1is removed.- Parameters:
- e1edge
interior edge of a face with its opposite being a boundary edge,
e1.oppwill becomee2- e2edge
interior edge of a face with its opposite being a boundary edge,
e2.oppwill becomee1
- Returns:
- None
- Raises:
- ValueError
If the arguments
e1ande2are not different boundary edges of the surface on which the method is called.
- validate()[source]
Validate a halfedge object.
The following checks are run (in order). By “all attributes” we mean nex, pre, opp, head for edges; edge for faces; edge for vertices. By “nodes” we mean vertices, edges and faces, with a generic one denoted by v, e or f.
Checks that all attributes point to instances of the correct node class belonging to this surface or None, if allowed (e.face == None indicates a boundary edge, v.edge == None indicates an isolated vertex).
Checks that no attributes point to removed nodes, meaning nodes with surf == None.
- Checks consistency of attributes of all nodes, namely:
e.nex.pre is e
e.face is e.nex.face
e.head is e.nex.opp.head
f.edge.face is f
v.edge.head is v
Checks that all face boundaries are simple loops.
Checks that all vertex coboundaries are simple loops. A vertex coboundary is the “asterisk” shape of incoming and outgoing edges of a vertex.
- Raises:
- SurfaceError
If object is invalid.
- validate_surface()[source]
Validate a 2D manifold.
Runs
validateplus these additional checks:Checks that object is not the empty set by checking if there are vertices.
Checks that for each edge, e.face and e.opp.face are not both None.
Checks that no two boundary edges have the same head.
Checks that there are no vertices with v.edge == None, i.e. isolated vertices.
- Raises:
- SurfaceError
If object is invalid or is not a 2D manifold.
- validate_curve()[source]
Validate a 1D manifold.
Runs
validate_graphplus these additional checks:Checks that object is not the empty set by checking if there are vertices.
Checks that all vertices have valency 2, by checking
e.nex.opp is e.opp.prefor every edge.Checks that there are no vertices with v.edge == None, i.e. isolated vertices.
- Raises:
- SurfaceError
If object is invalid or is not a 1D manifold.