Struct half_edge_mesh::mesh::HalfEdgeMesh[][src]

pub struct HalfEdgeMesh {
    pub edges: HashMap<u32, EdgeRc>,
    pub vertices: HashMap<u32, VertRc>,
    pub faces: HashMap<u32, FaceRc>,
    // some fields omitted
}

Half-Edge Mesh data structure While it's possible to create non-triangular faces, this code assumes triangular faces in several locations mesh.edges, mesh.vertices, and mesh.faces are HashMaps containing reference-counted Pointers to the mesh contents. Usually, these Rc values are the last values to exist. When they are destroyed, the pointed-to contents are destroyed as well. Vertex, edge, and face ids are mesh-specific and unique only within a certain mesh Integer overflow is undefined in Rust, but checked in debug builds. I think this means that it's possible to generate the same id twice, after 2^32-1 ids have been made. Try not to make more than 2^32-1 of any one of them, stuff might get messed up. TODO: Better error reporting, using a custom error type See also: http://blog.burntsushi.net/rust-error-handling/ Probably should do it whenever faces are added or a vertex is modified ? TODO: Better way of updating face-specific data like center and normals

Fields

Methods

impl HalfEdgeMesh
[src]

Constructs an empty mesh

Construct a half edge mesh from four points that form a tetrahedron A half-edge mesh requires at least a tetrahedron to be valid. When seen from an arbitrary "front" side of the tetrahedron, the vertices given to this function should be as follows: p1: apex, p2: bottom left front, p3: bottom right front, p4: bottom rear

Construct a half edge mesh from six points that form an octahedron p1: top apex, p2: mid left front, p3: mid right front, p4: mid left back, p5: mid right back, p6: bottom apex

Construct a half edge mesh from a Vec of vertices and a Vec of triplets of indices into the Vec of vertices.

Adds a tuple of (face, edge, edge, edge) to the mesh

Takes three Rc<RefCell<Vert>>, creates three edges and one face, and connects them as well as it can Note: since this creates a lone triangle, edge.pair links are still empty after this function

Checks if two faces are adjacent by looking for a shared edge

Replace a face with three faces, each connected to the new point And one of the face's previous vertices TODO: Make all of these mesh-manipulation functions return a Result<(), &str> to check that manipulation was completed

Attach a point to a mesh, replacing many faces (used for the convex hull algorithm) The faces should be a continuously connected group, each adjacent pair of vertices in the border of this group are connected to the point in a new triangular face. The programmer is responsible for ensuring that there are no holes in the passed set of faces. Returns Pointers to the new faces in the result, if successful

This function should only work if the vertex has exactly three adjacent edges. Therefore, it has three adjacent faces. The vertices connected to those edges form a new face, and the faces and edges connected to the removed vertex are also removed

flips an edge between two faces so that the faces are each split by the other diagonal of the parallelogram they form.

Inserts a vertex at the position, specified by tval, along edge.origin -> edge.next.origin The edge's two neighboring faces are each split into two faces. All four new faces include the new vertex

Auto Trait Implementations

impl !Send for HalfEdgeMesh

impl !Sync for HalfEdgeMesh