pub struct RoutePlanner<W> { /* private fields */ }Expand description
Per-agent route storage and movement controller.
Stores planned routes for agents (keyed by AgentId = u64) and
provides move_along_route functions that advance agents along
their planned paths at a given speed.
The generic parameter W is the waypoint type (e.g. (f64, f64)
or (f64, f64, f64)).
Implementations§
Source§impl<W> RoutePlanner<W>
impl<W> RoutePlanner<W>
Sourcepub fn set_route(&mut self, agent_id: u64, waypoints: Vec<W>)
pub fn set_route(&mut self, agent_id: u64, waypoints: Vec<W>)
Set a planned route for an agent, replacing any existing route.
Sourcepub fn is_stationary(&self, agent_id: u64) -> bool
pub fn is_stationary(&self, agent_id: u64) -> bool
Check whether an agent is stationary (has no route or route is empty).
Sourcepub fn route(&self, agent_id: u64) -> Option<&VecDeque<W>>
pub fn route(&self, agent_id: u64) -> Option<&VecDeque<W>>
Get the remaining waypoints for an agent (read-only).
Sourcepub fn clear_route(&mut self, agent_id: u64)
pub fn clear_route(&mut self, agent_id: u64)
Remove all route data for an agent.
Source§impl RoutePlanner<(f64, f64)>
impl RoutePlanner<(f64, f64)>
Sourcepub fn move_along_route_2d(
&mut self,
agent_id: u64,
current_pos: (f64, f64),
speed: f64,
dt: f64,
periodic: bool,
extent_x: f64,
extent_y: f64,
) -> MoveResult2D
pub fn move_along_route_2d( &mut self, agent_id: u64, current_pos: (f64, f64), speed: f64, dt: f64, periodic: bool, extent_x: f64, extent_y: f64, ) -> MoveResult2D
Move an agent one step along its 2D route at the given speed and timestep dt.
The agent moves from current_pos toward the next waypoint. If it
overshoots a waypoint, it continues toward the next one with the
remaining distance budget (mirrors Agents.jl move_along_route!).
Returns the new position and whether the route is now complete.
If the agent has no route, returns current_pos unchanged.
When periodic is true, movement wraps around [0, extent_x) x [0, extent_y).
Sourcepub fn plan_from_path(&mut self, agent_id: u64, waypoints: Vec<(f64, f64)>)
pub fn plan_from_path(&mut self, agent_id: u64, waypoints: Vec<(f64, f64)>)
Plan a route from a continuous A* path and store it.
Convenience method: accepts the waypoints from
ContinuousPath.
Source§impl RoutePlanner<(f64, f64, f64)>
impl RoutePlanner<(f64, f64, f64)>
Sourcepub fn move_along_route_3d(
&mut self,
agent_id: u64,
current_pos: (f64, f64, f64),
speed: f64,
dt: f64,
periodic: bool,
extent_x: f64,
extent_y: f64,
extent_z: f64,
) -> MoveResult3D
pub fn move_along_route_3d( &mut self, agent_id: u64, current_pos: (f64, f64, f64), speed: f64, dt: f64, periodic: bool, extent_x: f64, extent_y: f64, extent_z: f64, ) -> MoveResult3D
Move an agent one step along its 3D route at the given speed and timestep dt.
Same semantics as move_along_route_2d
but in 3D.
Source§impl RoutePlanner<(usize, usize)>
Grid (integer) route planner for (usize, usize) waypoints.
impl RoutePlanner<(usize, usize)>
Grid (integer) route planner for (usize, usize) waypoints.
Trait Implementations§
Source§impl<W: Clone> Clone for RoutePlanner<W>
impl<W: Clone> Clone for RoutePlanner<W>
Source§fn clone(&self) -> RoutePlanner<W>
fn clone(&self) -> RoutePlanner<W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more