pub struct Nav {
pub version: u32,
pub sub_version: u32,
pub areas: FxHashMap<u32, NavArea>,
pub is_analyzed: bool,
pub graph: DiGraphMap<u32, f64>,
}
Fields§
§version: u32
§sub_version: u32
§areas: FxHashMap<u32, NavArea>
§is_analyzed: bool
§graph: DiGraphMap<u32, f64>
Implementations§
pub const MAGIC: u32 = 4_277_009_102u32
Sourcepub fn find_area(&self, position: &Position) -> Option<&NavArea>
pub fn find_area(&self, position: &Position) -> Option<&NavArea>
Find the area that contains the position and has the closest centroid by z.
If no area contains the position, then None
is returned.
§Panics
Will panic if the comparison of the position centroid z values against any area centroid z values returns None
.
Sourcepub fn find_closest_area_centroid(&self, position: &Position) -> &NavArea
pub fn find_closest_area_centroid(&self, position: &Position) -> &NavArea
Find the area with the closest centroid to the position.
§Panics
Will panic if the comparison of the positions centroid distance against any area centroid distance returns None
.
Sourcepub fn save_to_json(&self, filename: &Path)
pub fn save_to_json(&self, filename: &Path)
Save the navigation mesh to a JSON file.
§Panics
Will panic if the file cannot be created or written to.
pub fn new( version: u32, sub_version: u32, areas: HashMap<u32, NavArea>, is_analyzed: bool, ) -> Self
Sourcepub fn find_path(&self, start: AreaIdent, end: AreaIdent) -> PathResult
pub fn find_path(&self, start: AreaIdent, end: AreaIdent) -> PathResult
Finds the path between two areas or positions.
Sourcepub fn find_area_py(&self, position: &Position) -> Option<NavArea>
pub fn find_area_py(&self, position: &Position) -> Option<NavArea>
Find the area that contains the position and has the closest centroid by z.
If no area contains the position, then None
is returned.
Sourcepub fn find_closest_area_centroid_py(&self, position: &Position) -> NavArea
pub fn find_closest_area_centroid_py(&self, position: &Position) -> NavArea
Find the area with the closest centroid to the position.
Sourcepub fn save_to_json_py(&self, path: PathBuf)
pub fn save_to_json_py(&self, path: PathBuf)
Save the navigation mesh to a JSON file.
Sourcepub fn from_json_py(path: PathBuf) -> Self
pub fn from_json_py(path: PathBuf) -> Self
Load a struct instance from a JSON file
Trait Implementations§
Source§type Output = Bound<'py, <Nav as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <Nav as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<Nav>
type ThreadChecker = SendablePyClass<Nav>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
fn new_text_signature(self) -> Option<&'static str>
fn py_methods(self) -> &'static PyClassItems
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
.Source§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.Source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
.Source§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.Source§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
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>
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>
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.