Struct cell_map::CellMapParams [−][src]
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: Boundsrotation_in_parent_rad: f64The 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: f64The 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
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>, Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for CellMapParamsimpl Send for CellMapParamsimpl Sync for CellMapParamsimpl Unpin for CellMapParamsimpl UnwindSafe for CellMapParamsBlanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = TShould always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> boolChecks if self is actually part of its subset T (and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SSUse with care! Same as self.to_subset but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SPThe inclusion map: converts self to the equivalent element of its superset.