pub struct CellMapParams {
pub cell_size: Vector2<f64>,
pub cell_bounds: Bounds,
pub rotation_in_parent_rad: f64,
pub position_in_parent: Vector2<f64>,
pub cell_boundary_precision: f64,
}
Expand description
Contains parameters required to construct a CellMap
Fields§
§cell_size: Vector2<f64>
The size (resolution) of each cell in the map, in parent frame coordinates.
§Default
The default value is [1.0, 1.0]
.
cell_bounds: Bounds
§rotation_in_parent_rad: f64
The rotation of the map’s Z axis about the parent Z axis in radians.
§Default
The default value is 0.0
.
position_in_parent: Vector2<f64>
The position of the origin of the map in the parent frame, in parent frame units.
§Default
The default value is [0.0, 0.0]
.
cell_boundary_precision: f64
The precision to use when determining cell boundaries.
This precision factor allows us to account for times when a cell position should fit into a
particular cell index, but due to floating point rounding does not. For example take a map
with a cell_size = [0.1, 0.1]
, the cell index of the position [0.7, 0.1]
should be [7, 1
], however the positions floating point index would be calculated as [6.999999999999998, 0.9999999999999999]
, which if floor()
ed to fit into a usize
would give the incorrect
index [6, 0]
.
When calculating cell index we therefore floor
the floating point index unless it is
within cell_size * cell_boundary_precision
, in which case we round up to the next cell.
Mutliplying by cell_size
allows this value to be independent of the scale of the map.
§Default
The default value is 1e-10
.
Trait Implementations§
Source§impl Clone for CellMapParams
impl Clone for CellMapParams
Source§fn clone(&self) -> CellMapParams
fn clone(&self) -> CellMapParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CellMapParams
impl Debug for CellMapParams
Source§impl Default for CellMapParams
impl Default for CellMapParams
Source§impl<'de> Deserialize<'de> for CellMapParams
impl<'de> Deserialize<'de> for CellMapParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CellMapParams
impl Serialize for CellMapParams
impl Copy for CellMapParams
Auto Trait Implementations§
impl Freeze for CellMapParams
impl RefUnwindSafe for CellMapParams
impl Send for CellMapParams
impl Sync for CellMapParams
impl Unpin for CellMapParams
impl UnwindSafe for CellMapParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.