diff --git a/src/astar.rs b/src/astar.rs index d25be61..1fa0ee3 100644 --- a/src/astar.rs +++ b/src/astar.rs @@ -10,7 +10,7 @@ use std::collections::{BinaryHeap, HashMap}; use std::hash::Hash; use petgraph::algo::Measure; -use petgraph::visit::{EdgeRef, GraphBase, IntoEdges, Visitable}; +use petgraph::visit::{EdgeRef, GraphBase, IntoEdges}; use std::cmp::Ordering; @@ -96,7 +96,7 @@ where pub trait AstarStrategy where - G: IntoEdges + Visitable, + G: IntoEdges, K: Measure + Copy, G::NodeId: Eq + Hash, { @@ -111,7 +111,7 @@ pub fn astar( strategy: &mut impl AstarStrategy, ) -> Option<(K, Vec)> where - G: IntoEdges + Visitable, + G: IntoEdges, G::NodeId: Eq + Hash, K: Measure + Copy, { diff --git a/src/mesh.rs b/src/mesh.rs index e1c0586..9806dee 100644 --- a/src/mesh.rs +++ b/src/mesh.rs @@ -91,50 +91,6 @@ impl visit::GraphBase for Mesh { type EdgeId = (VertexIndex, VertexIndex); } -pub struct MeshVisitMap { - fixedbitset: FixedBitSet, -} - -impl MeshVisitMap { - pub fn with_capacity(bits: usize) -> Self { - Self { - fixedbitset: FixedBitSet::with_capacity(bits), - } - } - - pub fn clear(&mut self) { - self.fixedbitset.clear(); - } - - pub fn grow(&mut self, bits: usize) { - self.fixedbitset.grow(bits); - } -} - -impl visit::VisitMap for MeshVisitMap { - fn visit(&mut self, a: T) -> bool { - !self.fixedbitset.put(a.node_index().index()) - } - - fn is_visited(&self, a: &T) -> bool { - self.fixedbitset.contains(a.node_index().index()) - } -} - -impl visit::Visitable for Mesh { - type Map = MeshVisitMap; - - fn visit_map(&self) -> Self::Map { - // FIXME: This seems wrong, but pathfinding works for some reason. Investigate. - MeshVisitMap::with_capacity(self.triangulation.num_vertices()) - } - - fn reset_map(&self, map: &mut Self::Map) { - map.clear(); - map.grow(self.triangulation.num_vertices()); - } -} - impl visit::Data for Mesh { type NodeWeight = (); type EdgeWeight = ();