From c1271e570e0c6516453fe5e17ce9aa2572c15dca Mon Sep 17 00:00:00 2001 From: hakki Date: Tue, 29 Oct 2024 19:53:47 +0100 Subject: [PATCH] docs: navigation mesh documented --- src/autorouter/invoker.rs | 1 + src/router/navmesh.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/autorouter/invoker.rs b/src/autorouter/invoker.rs index 29bae45..7774cc6 100644 --- a/src/autorouter/invoker.rs +++ b/src/autorouter/invoker.rs @@ -28,6 +28,7 @@ use super::{ #[enum_dispatch] pub trait GetMaybeNavmesh { + /// Returns navigation mesh if possible fn maybe_navmesh(&self) -> Option<&Navmesh>; } diff --git a/src/router/navmesh.rs b/src/router/navmesh.rs index f14abb4..54b88d9 100644 --- a/src/router/navmesh.rs +++ b/src/router/navmesh.rs @@ -117,6 +117,10 @@ pub enum NavmeshError { Insertion(#[from] InsertionError), } +/// Contains Navigation Mesh properties +/// +/// Navigation Mesh is a mesh of possible routes between +/// two nodes #[derive(Debug, Clone)] pub struct Navmesh { graph: UnGraph, @@ -127,6 +131,10 @@ pub struct Navmesh { } impl Navmesh { + /// Create new Navigation mesh + /// + /// Method to create new Navigation Mesh between + /// origin and destination nodes pub fn new( layout: &Layout, origin: FixedDotIndex, @@ -291,22 +299,27 @@ impl Navmesh { .push((navvertex1, navvertex2)); } + /// Returns Graph with undirected edges of Navigation Vertex pub fn graph(&self) -> &UnGraph { &self.graph } + /// Returns origin node index pub fn origin(&self) -> FixedDotIndex { self.origin } + /// Returns Navigation Vertex of origin node pub fn origin_navvertex(&self) -> NavvertexIndex { self.origin_navvertex } - + + /// Returns destination node index pub fn destination(&self) -> FixedDotIndex { self.destination } + /// Returns Navigation Vertex of destination node pub fn destination_navvertex(&self) -> NavvertexIndex { self.destination_navvertex }