Skip to main content

HalfEdgeMesh

Struct HalfEdgeMesh 

Source
pub struct HalfEdgeMesh<C: Config = PolyConfig> { /* private fields */ }
Expand description

Implementation of the half edge mesh. This data structure is widely used in geometry processing due to its many capabilities paired with fairly good speed and memory consumption.

This data structure allows you to represent polygon meshes where each face can have differently many vertices. (However, you can restrict this mesh to triangle meshes via the configuration.) Furthermore, it can answer all adjacency queries and exposes full edges.

The half edge mesh is a half-edge based data structure, with most of the connectivity stored per half edge. Each face and vertex just store one arbitrary half edge handle. This diagram illustrates the fields stored per half edge. (Not shown in the diagram: each half edge also stores the handle of its face.)

ee.nexte.preve.twine.target

§References

Introduced in: Mäntylä, Martti. An introduction to solid modeling. Computer science press, 1988.

Trait Implementations§

Source§

impl<C: Config> BasicAdj for HalfEdgeMesh<C>

Source§

type VerticesAroundFaceIter<'s> = FaceToVertexIter<'s, C>

Source§

fn vertices_around_triangle(&self, face: FaceHandle) -> [VertexHandle; 3]
where Self: TriMesh,

Returns the vertices of the given triangular face in front-face CCW order.
Source§

fn vertices_around_face( &self, face: FaceHandle, ) -> Self::VerticesAroundFaceIter<'_>

Returns the vertices around the given face in front-face CCW order. Read more
Source§

fn is_vertex_around_face(&self, vertex: VertexHandle, face: FaceHandle) -> bool

Checks whether the given vertex is adjacent to the given face.
Source§

impl<C: Config> Clone for HalfEdgeMesh<C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Config> Debug for HalfEdgeMesh<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: Config> EdgeAdj for HalfEdgeMesh<C>

Source§

type EdgesAroundVertexIter<'s> = VertexToEdgeIter<'s, C>

Source§

type EdgesAroundFaceIter<'s> = FaceToEdgeIter<'s, C>

Source§

fn endpoints_of_edge(&self, edge: EdgeHandle) -> [VertexHandle; 2]

Returns the (up to) two endpoints of a given edge. Read more
Source§

fn faces_of_edge(&self, edge: EdgeHandle) -> DiList<FaceHandle>

Returns the (up to) two faces of the given edge.
Source§

fn edges_around_vertex( &self, vertex: VertexHandle, ) -> Self::EdgesAroundVertexIter<'_>

Returns all edges around the given vertex.
Source§

fn edges_around_face(&self, face: FaceHandle) -> Self::EdgesAroundFaceIter<'_>

Returns all edges around/of the given face.
Source§

fn edges_around_triangle(&self, face: FaceHandle) -> [EdgeHandle; 3]
where Self: TriMesh,

Returns all three edges around/of the given triangular face.
Source§

fn is_boundary_edge(&self, edge: EdgeHandle) -> bool

Returns true iff the edge is a boundary edge, i.e. if it has fewer than 2 adjacent faces.
Source§

fn edge_between_vertices( &self, a: VertexHandle, b: VertexHandle, ) -> Option<EdgeHandle>

Returns the edge connecting the two given vertices, or None if the two vertices are not connected.
Source§

impl<C: Config> Empty for HalfEdgeMesh<C>

Source§

fn empty() -> Self

Returns an empty value of this type.
Source§

impl<C: Config> FullAdj for HalfEdgeMesh<C>

Source§

type FacesAroundFaceIter<'s> = FaceToFaceIter<'s, C>

Source§

type FacesAroundVertexIter<'s> = VertexToFaceIter<'s, C>

Source§

type VerticesAroundVertexIter<'s> = VertexToVertexIter<'s, C>

Source§

fn faces_around_triangle(&self, face: FaceHandle) -> TriList<FaceHandle>
where Self: TriMesh,

Returns the faces around the given triangular face in front-face CCW order. Read more
Source§

fn faces_around_face(&self, face: FaceHandle) -> Self::FacesAroundFaceIter<'_>

Returns the faces around the given face in front-face CCW order. Read more
Source§

fn faces_around_vertex( &self, vh: VertexHandle, ) -> Self::FacesAroundVertexIter<'_>

Returns a list of all faces adjacent to the given vertex. Read more
Source§

fn vertices_around_vertex( &self, vh: VertexHandle, ) -> Self::VerticesAroundVertexIter<'_>

Returns a list of all faces adjacent to the given vertex. Read more
Source§

fn is_boundary_face(&self, face: FaceHandle) -> bool

Checks if the given face lies on a boundary. A face is a boundary face if the number of adjacent faces does not match the number of adjacent vertices. Read more
Source§

fn is_boundary_vertex(&self, vertex: VertexHandle) -> bool

Checks if the given vertex lies on a boundary. A vertex is a boundary vertex if the number of adjacent faces does not match the number of adjacent vertices or if it is an isolated vertex. Read more
Source§

fn is_isolated_vertex(&self, vertex: VertexHandle) -> bool

Checks if the given vertex is isolated, meaning that it has no adjacent faces, edges or vertices.
Source§

fn are_faces_adjacent(&self, a: FaceHandle, b: FaceHandle) -> bool

Checks whether the two given faces share an edge (are “adjacent” to one another).
Source§

fn are_vertices_adjacent(&self, a: VertexHandle, b: VertexHandle) -> bool

Checks whether the two given faces share an edge (are “adjacent” to one another).
Source§

impl<C: Config> Mesh for HalfEdgeMesh<C>

Source§

type FaceKind = <C as Config>::FaceKind

The kind of faces this mesh type can store. Either TriFaces or PolyFaces. Read more
Source§

type Orientable = True

Denotes whether this mesh is always orientable or potentially non-orientable. Read more
Source§

fn num_vertices(&self) -> hsize

Returns the number of vertices in this mesh.
Source§

fn next_vertex_handle_from(&self, start: VertexHandle) -> Option<VertexHandle>

Returns the next handle of an existing vertex with an index ≥ start’s index, or None if there is no such handle. Read more
Source§

fn next_face_handle_from(&self, start: FaceHandle) -> Option<FaceHandle>

Returns the next handle of an existing face with an index ≥ start’s index, or None if there is no such handle. Read more
Source§

fn last_vertex_handle(&self) -> Option<VertexHandle>

Returns the vertex handle for an existing vertex with the highest index, or None if there are no vertices in the mesh. Read more
Source§

fn last_face_handle(&self) -> Option<FaceHandle>

Returns the face handle for an existing face with the highest index, or None if there are no vertices in the mesh. Read more
Source§

fn contains_vertex(&self, vertex: VertexHandle) -> bool

Checks if the given vertex handle refers to a valid vertex of this mesh.
Source§

fn num_faces(&self) -> hsize

Returns the number of faces in this mesh.
Source§

fn contains_face(&self, face: FaceHandle) -> bool

Checks if the given face handle refers to a valid face of this mesh.
Source§

fn num_edges(&self) -> hsize
where Self: EdgeMesh,

Returns the number of edges in this mesh.
Source§

fn next_edge_handle_from(&self, start: EdgeHandle) -> Option<EdgeHandle>
where Self: EdgeMesh,

Returns the next handle of an existing edge with an index ≥ start’s index, or None if there is no such handle. Read more
Source§

fn last_edge_handle(&self) -> Option<EdgeHandle>
where Self: EdgeMesh,

Returns the edge handle for an existing edge with the highest index, or None if there are no vertices in the mesh. Read more
Source§

fn contains_edge(&self, edge: EdgeHandle) -> bool
where Self: EdgeMesh,

Checks if the given edge handle refers to a valid edge of this mesh.
Source§

fn check_integrity(&self)

Performs a number of integrity checks on internal data and panics if something is broken. Read more
Source§

fn get_ref<H: Handle>(&self, handle: H) -> ElementRef<'_, H, Self>

Returns an ElementRef with the given handle referencing this mesh.
Source§

fn vertex_handles(&self) -> HandleIter<'_, Self, VertexHandle>

Returns an iterator over the handles of all vertices in this mesh. Read more
Source§

fn vertex_handles_mut(&mut self) -> HandleIterMut<'_, Self, VertexHandle>

Returns an iterator over the handles of all vertices which can return a mutable reference to the mesh. This is useful when it is necessary to mutate the mesh while iterating. Read more
Source§

fn vertices(&self) -> ElementRefIter<'_, Self, VertexHandle>

Returns an iterator over all vertices in this mesh. Read more
Source§

fn face_handles(&self) -> HandleIter<'_, Self, FaceHandle>

Returns an iterator over the handles of all faces in this mesh. Read more
Source§

fn face_handles_mut(&mut self) -> HandleIterMut<'_, Self, FaceHandle>

Returns an iterator over the handles of all faces which can return a mutable reference to the mesh. This is useful when it is necessary to mutate the mesh while iterating. Read more
Source§

fn faces(&self) -> ElementRefIter<'_, Self, FaceHandle>

Returns an iterator over all faces in this mesh. Read more
Source§

fn edge_handles(&self) -> HandleIter<'_, Self, EdgeHandle>
where Self: EdgeMesh,

Returns an iterator over the handles of all edges in this mesh. Read more
Source§

fn edge_handles_mut(&mut self) -> HandleIterMut<'_, Self, EdgeHandle>
where Self: EdgeMesh,

Returns an iterator over the handles of all edges which can return a mutable reference to the mesh. This is useful when it is necessary to mutate the mesh while iterating. Read more
Source§

fn edges(&self) -> ElementRefIter<'_, Self, EdgeHandle>
where Self: EdgeMesh,

Returns an iterator over all edges in this mesh. Read more
Source§

fn is_tri_mesh(&self) -> bool

Returns true if Self is a TriMesh, meaning that all faces are triangles. If false is returned, that means that you can’t assume all faces are triangles, but it could still be the case.
Source§

impl<C: Config> MeshMut for HalfEdgeMesh<C>

Source§

fn add_vertex(&mut self) -> VertexHandle

Adds a new, unconnected vertex to the mesh and returns the handle representing that vertex. Read more
Source§

fn add_triangle(&mut self, [a, b, c]: [VertexHandle; 3]) -> FaceHandle

Adds a new triangular face (defined by the three vertices in CCW order) to this mesh and returns the handle representing that face. Read more
Source§

fn add_face(&mut self, vertices: &[VertexHandle]) -> FaceHandle
where Self: PolyMesh,

Adds a new face to this mesh and returns the handle representing that face. Read more
Source§

fn remove_isolated_vertex(&mut self, v: VertexHandle)

Removes the given isolated vertex from the mesh. You have to make sure that the given vertex is indeed isolated! Read more
Source§

fn remove_face(&mut self, f: FaceHandle)

Removes the given face and all of its boundary edges. Will not remove any vertices.
Source§

fn reserve_for_vertices(&mut self, count: hsize)

Reserves memory for count additional vertices. Read more
Source§

fn reserve_for_faces(&mut self, count: hsize)

Reserves memory for count additional faces. Read more
Source§

fn remove_all_vertices(&mut self)

Removes all vertices of this mesh. Read more
Source§

fn remove_all_faces(&mut self)

Removes all faces of this mesh. This can be more efficient than calling remove_face for each face individually. Also removes all edges.
Source§

fn split_face(&mut self, f: FaceHandle) -> VertexHandle

Splits the face f into k new faces (where k is the valence of f) by inserting a center vertex. This new vertex is returned. This operation is sometimes called “1-to-n split”. Read more
Source§

fn flip_edge(&mut self, edge: EdgeHandle)
where Self: TriMesh + EdgeMesh,

Performs the “edge flip” operation on e. Requires e to be an interior edge (i.e. being adjacent to two faces). Read more
Source§

fn split_edge_with_faces( &mut self, edge: EdgeHandle, ) -> SplitEdgeWithFacesResult
where Self: TriMesh + EdgeMesh,

Splits the given edge and its neighboring faces into two, each. Read more
Source§

impl<C: Config> EdgeMesh for HalfEdgeMesh<C>

Source§

impl<C: Config> SupportsMultiBlade for HalfEdgeMesh<C>

Auto Trait Implementations§

§

impl<C> Freeze for HalfEdgeMesh<C>

§

impl<C> RefUnwindSafe for HalfEdgeMesh<C>
where C: RefUnwindSafe, <<C as Config>::PrevEdge as OptionalField>::Storage<Checked<HalfEdgeHandle>>: RefUnwindSafe,

§

impl<C> Send for HalfEdgeMesh<C>
where C: Send, <<C as Config>::PrevEdge as OptionalField>::Storage<Checked<HalfEdgeHandle>>: Send,

§

impl<C> Sync for HalfEdgeMesh<C>
where C: Sync, <<C as Config>::PrevEdge as OptionalField>::Storage<Checked<HalfEdgeHandle>>: Sync,

§

impl<C> Unpin for HalfEdgeMesh<C>
where C: Unpin, <<C as Config>::PrevEdge as OptionalField>::Storage<Checked<HalfEdgeHandle>>: Unpin,

§

impl<C> UnsafeUnpin for HalfEdgeMesh<C>

§

impl<C> UnwindSafe for HalfEdgeMesh<C>
where C: UnwindSafe, <<C as Config>::PrevEdge as OptionalField>::Storage<Checked<HalfEdgeHandle>>: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CastFrom<T> for T

Source§

type Fidelity = SameType

Fidelity with which this cast is performed.
Source§

fn cast_from(src: T) -> T

Performs the cast. Read more
Source§

impl<Src, Dst> CastInto<Dst> for Src
where Dst: CastFrom<Src>,

Source§

type Fidelity = <Dst as CastFrom<Src>>::Fidelity

Source§

fn cast_into(self) -> Dst

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<M> Orientable for M
where M: Mesh<Orientable = True>,

Source§

impl<T> PolyMesh for T
where T: Mesh<FaceKind = PolyFaces>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> TriMesh for T
where T: Mesh<FaceKind = TriFaces>,