Struct genmesh::Neighbors
[−]
[src]
pub struct Neighbors<T> { pub vertices: Vec<T>, pub polygons: Vec<Triangle<usize>>, // some fields omitted }
Fields
vertices: Vec<T>
polygons: Vec<Triangle<usize>>
Methods
impl<T> Neighbors<T>
[src]
fn new(vertices: Vec<T>, polygons: Vec<Triangle<usize>>) -> Self
Build a Neighbors search based on the supplied vertices and supplied triangle list.
fn split(self) -> (Vec<T>, Vec<Triangle<usize>>)
return the vector and triangle list used to create the Neighbors
fn vertex_neighbors(&self, t: &usize) -> Option<&[usize]>
looks up the index of every polygon that contains vertex t, this can be used to calculate new faces
fn polygon_neighbors(&self, i: usize) -> Option<HashSet<usize>>
looks up the index of every polygon that is a neighbor of polygon at index i. This can be used to prep data for a Geometry shader (eg trinagle_adjacency)
fn normal_for_face<F>(&self, i: usize, f: F) -> [f32; 3] where
F: FnMut(&T) -> [f32; 3],
F: FnMut(&T) -> [f32; 3],
Calculate the normal for face. This is a flat
shading
You must supply a function that can be used to lookup The position which is needed to calculate the normal
fn normal_for_vertex<F>(&self, i: usize, f: F) -> [f32; 3] where
F: FnMut(&T) -> [f32; 3],
F: FnMut(&T) -> [f32; 3],
Calculate the normal for an vertex based on the average
of it's Neighbors this is a smooth
shading
You must supply a function that can be used to lookup The position which is needed to calculate the normal