Struct landmass::NavigationMesh
source · pub struct NavigationMesh<CS: CoordinateSystem> {
pub vertices: Vec<CS::Coordinate>,
pub polygons: Vec<Vec<usize>>,
pub polygon_type_indices: Vec<usize>,
}
Expand description
A navigation mesh.
Fields§
§vertices: Vec<CS::Coordinate>
The vertices that make up the polygons.
polygons: Vec<Vec<usize>>
The polygons of the mesh. Polygons are indices to the vertices
that
make up the polygon. Polygons must be convex, and oriented
counterclockwise (using the right hand rule). Polygons are assumed to be
not self-intersecting.
polygon_type_indices: Vec<usize>
The type index of each polygon. This type index is translated into a real
crate::NodeType
when assigned to an crate::Archipelago
. Must be
the same length as Self::polygons
.
Implementations§
sourcepub fn validate(self) -> Result<ValidNavigationMesh<CS>, ValidationError>
pub fn validate(self) -> Result<ValidNavigationMesh<CS>, ValidationError>
Ensures required invariants of the navigation mesh, and computes additional derived properties to produce and optimized and validated navigation mesh. Returns an error if the navigation mesh is invalid in some way.
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more