Skip to content

Commit

Permalink
improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenGar committed Apr 4, 2024
1 parent 30dd0fa commit 9b1fa41
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions jagua-rs/src/collision_detection/cd_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ impl CDEngine {
}

/// Removes a hazard from the CDE.
/// If `commit_instantly == true`, the deregistration is fully executed immediately.
/// If `commit_instantly == false`, the deregistration causes the hazard to be deactivated in the quadtree and
/// If `commit_instant` the deregistration is fully executed immediately.
/// If not, the deregistration causes the hazard to be deactivated in the quadtree and
/// the hazard_proximity_grid to become dirty (and therefore inaccessible).
/// <br>
/// Can be beneficial not to `commit_instantly` if multiple hazards are to be deregistered, or if the chance of
/// Can be beneficial not to `commit_instant` if multiple hazards are to be deregistered, or if the chance of
/// restoring from a snapshot with the hazard present is high.
/// <br>
/// Call [`Self::commit_deregisters`] to commit all uncommitted deregisters in both quadtree & hazard proximity grid
Expand Down Expand Up @@ -250,7 +250,7 @@ impl CDEngine {
}
}

/// Flushes all uncommitted deregisters in the [HazardProximityGrid].
/// Flushes all uncommitted deregisters in the [`HazardProximityGrid`].
pub fn flush_haz_prox_grid(&mut self) {
self.haz_prox_grid
.as_mut()
Expand Down
10 changes: 7 additions & 3 deletions jagua-rs/src/collision_detection/hpg/hazard_proximity_grid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::fmt::{Display, Formatter};
use std::iter;

use itertools::Itertools;
Expand Down Expand Up @@ -154,8 +155,11 @@ impl HazardProximityGrid {
#[derive(Debug)]
pub struct DirtyState;

impl std::fmt::Display for DirtyState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "HazardProximityGrid is in a dirty state. Call `flush_deregisters` before accessing the grid.")
impl Display for DirtyState {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"Dirty state detected. Make sure all changes are flushed before accessing the grid."
)
}
}
1 change: 1 addition & 0 deletions jagua-rs/src/entities/problems/problem_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub trait ProblemGeneric: ProblemGenericPrivate {

fn bin_qtys(&self) -> &[usize];

/// Makes sure that the all collision detection engines are completely updated with the changes made to the layouts.
fn flush_changes(&mut self) {
self.layouts_mut()
.iter_mut()
Expand Down

0 comments on commit 9b1fa41

Please sign in to comment.