Struct hedge::Mesh [] [src]

pub struct Mesh {
    pub edge_list: Vec<Edge>,
    pub vertex_list: Vec<Vertex>,
    pub face_list: Vec<Face>,
}

Implements the fundamental storage operations and represents the principle grouping of all components.

Fields

Methods

impl Mesh
[src]

Creates a new Mesh with an initial component added to each Vec.

The idea behind having a single invalid component at the front of each Vec comes from the blog http://ourmachinery.com/post/defaulting-to-zero/

Mark the two edges as adjacent twins.

In order for this to be valid each edge should be connected in such a way that the vertex of each is the same as the vertex of the next edge of each.

So: A->Next->Vertex == B->Vertex && B->Next->Vertex == A->Vertex

In debug builds we assert the provided indices are valid.

Connects the two edges as part of an edge loop.

In debug builds we assert that neither index is not the default index.

Create a new edge from the specified vertex.

In debug builds we assert that the vertex index is not the default index.

Create a new edge as a twin of the specified edge

In debug builds we assert that the twin index is not the default index and that the twins next index is not the default index (since we need that edge to find the correct vertex index).

Create a new edge connected to the previous edge specified.

In debug builds we assert that the indices specified are valid.

Create a new edge, closing an edge loop, using the prev and next indices provided.

In debug builds we assert that all specified indices are valid.

Adds the provided Edge to the mesh and returns it's EdgeIndex

Adds the provided Vertex to the mesh and returns it's VertexIndex

Creates a new face and associated edges with the given vertex indices. Returns the index of the newly added face.

In debug builds we assert that all provided indices are valid.

Creates a new face and associated edges with the given a vertex index and a twin edge index. Returns the index of the newly added face.

In debug builds we assert that the all provided indices are valid.

Returns a Faces iterator for this mesh.

let mesh = hedge::Mesh::new();
for index in mesh.faces() {
   let face = mesh.face(index);
}

Returns an EdgeLoop iterator for the edges around the specified face.

let mesh = hedge::Mesh::new();
for findex in mesh.faces() {
   let face = mesh.face(findex);
   for eindex in mesh.edges(face) {
       let edge = mesh.edge(eindex);
   }
}

Returns an EdgeLoopVertices iterator for the vertices around the specified face.

let mesh = hedge::Mesh::new();
for findex in mesh.faces() {
   let face = mesh.face(findex);
   for vindex in mesh.vertices(face) {
       let vertex = mesh.vertex(vindex);
   }
}

Returns a FaceFn for the given index.

use hedge::{Mesh, Vertex};
let mut mesh = Mesh::new();

let v1 = mesh.add_vertex(Vertex::default());
let v2 = mesh.add_vertex(Vertex::default());
let v3 = mesh.add_vertex(Vertex::default());

let f1 = mesh.add_triangle(v1, v2, v3);

assert!(mesh.face_fn(f1).edge().next().vertex().index == v2);

Obtains a mutable reference to the Face for the provided index.

Returns an EdgeFn for the given index.

Obtains a mutable reference to the Edge for the provided index.

Returns a VertexFn for the given index.

Obtains a mutable reference to the Vertex for the provided index.

Trait Implementations

impl Debug for Mesh
[src]

Formats the value using the given formatter.