Struct Neighbors

Source
pub struct Neighbors<T> {
    pub vertices: Vec<T>,
    pub polygons: Vec<Triangle<usize>>,
    /* private fields */
}
Expand description

Neighbors search accelerating structure.

Fields§

§vertices: Vec<T>

Mesh vertices.

§polygons: Vec<Triangle<usize>>

Mesh polygons.

Implementations§

Source§

impl<T> Neighbors<T>

Source

pub fn new(vertices: Vec<T>, polygons: Vec<Triangle<usize>>) -> Self

Build a Neighbors search based on the supplied vertices and supplied triangle list.

Source

pub fn split(self) -> (Vec<T>, Vec<Triangle<usize>>)

return the vector and triangle list used to create the Neighbors

Source

pub 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

Source

pub 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)

Source

pub fn normal_for_face<F>(&self, i: usize, f: F) -> Normal
where F: FnMut(&T) -> Normal,

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

Source

pub fn normal_for_vertex<F>(&self, i: usize, f: F) -> Normal
where F: FnMut(&T) -> Normal,

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

Auto Trait Implementations§

§

impl<T> Freeze for Neighbors<T>

§

impl<T> RefUnwindSafe for Neighbors<T>
where T: RefUnwindSafe,

§

impl<T> Send for Neighbors<T>
where T: Send,

§

impl<T> Sync for Neighbors<T>
where T: Sync,

§

impl<T> Unpin for Neighbors<T>
where T: Unpin,

§

impl<T> UnwindSafe for Neighbors<T>
where T: UnwindSafe,

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> 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, 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.