feat: Debug print various TopoNavmesh structures / updates

- feat(autorouter/execution): Debug-print the whole TopoNavmesh on completion
- feat(router/ng/poly): Emit log output on route_to_exit success
This commit is contained in:
Ellen Emilia Anna Zscheile 2025-05-23 19:59:48 +02:00
parent a561b278fc
commit ed06170db5
5 changed files with 30 additions and 1 deletions

View File

@ -55,6 +55,7 @@ enum_dispatch = "0.3"
geo.workspace = true geo.workspace = true
log.workspace = true log.workspace = true
petgraph.workspace = true petgraph.workspace = true
ron = "0.10"
rstar.workspace = true rstar.workspace = true
serde.workspace = true serde.workspace = true
spade.workspace = true spade.workspace = true

View File

@ -393,6 +393,14 @@ impl<'a, B: NavmeshBase + 'a> NavmeshRefMut<'a, B> {
} }
impl<'a, B: NavmeshBase + 'a> NavmeshRef<'a, B> { impl<'a, B: NavmeshBase + 'a> NavmeshRef<'a, B> {
pub fn to_owned(&self) -> Navmesh<B> {
Navmesh {
nodes: Arc::new(self.nodes.clone()),
edges: Arc::new(self.edges.clone()),
edge_paths: self.edge_paths.to_vec().into_boxed_slice(),
}
}
#[inline(always)] #[inline(always)]
pub fn resolve_edge_data( pub fn resolve_edge_data(
&self, &self,

View File

@ -86,6 +86,19 @@ impl<M: AccessMesadata + Clone> ExecutionStepper<M> {
.board .board
.try_set_band_between_nodes(source, target, *band); .try_set_band_between_nodes(source, target, *band);
} }
let topo_navmesh = autoroute.maybe_topo_navmesh().unwrap().to_owned();
let mut pretty_config = ron::ser::PrettyConfig::new();
pretty_config.depth_limit = 2;
log::debug!(
"topo navmesh result: {}",
ron::ser::to_string_pretty(
&ng::pie::navmesh::NavmeshSer::from(topo_navmesh),
pretty_config
)
.unwrap()
);
ControlFlow::Break(( ControlFlow::Break((
Some(autoroute.last_recorder.clone()), Some(autoroute.last_recorder.clone()),
"finished topo-autorouting".to_string(), "finished topo-autorouting".to_string(),

View File

@ -50,7 +50,9 @@ pub use router::*;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct PieNavmeshBase; pub struct PieNavmeshBase;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
)]
pub struct EtchedPath { pub struct EtchedPath {
pub end_points: EdgeIndex<FixedDotIndex>, pub end_points: EdgeIndex<FixedDotIndex>,
} }

View File

@ -202,6 +202,11 @@ impl PolygonRouting {
break; break;
} }
} }
log::debug!(
"route_to_exit on {:?} finished, head = {:?}",
self.apex,
active_head,
);
Ok((active_head, route_length)) Ok((active_head, route_length))
} }
} }