use super::Grid2d;
use crate::types::{Footprint, Pose2};
impl<T> Grid2d<T> {
pub fn footprint_cost(&self, pose: Pose2, footprint: &Footprint) -> T
where
T: Default + Ord + Copy,
{
if !footprint.is_valid() {
return T::default();
}
let transformed_footprint = footprint.transform(pose);
let mut max_cost = T::default();
if let Some(iter) = self.polygon_value(&transformed_footprint) {
for cost in iter {
if *cost > max_cost {
max_cost = *cost;
}
}
}
max_cost
}
}