jagua_rs/entities/
placed_item.rsuse crate::collision_detection::hazard_filter::QZHazardFilter;
use crate::entities::item::Item;
use crate::geometry::d_transformation::DTransformation;
use crate::geometry::geo_traits::Transformable;
use crate::geometry::primitives::simple_polygon::SimplePolygon;
use slotmap::new_key_type;
use std::sync::Arc;
new_key_type! {
pub struct PItemKey;
}
#[derive(Clone, Debug)]
pub struct PlacedItem {
pub item_id: usize,
pub d_transf: DTransformation,
pub hazard_filter: Option<QZHazardFilter>,
pub shape: Arc<SimplePolygon>,
}
impl PlacedItem {
pub fn new(item: &Item, d_transf: DTransformation) -> Self {
let transf = d_transf.compose();
let shape = Arc::new(item.shape.transform_clone(&transf));
let qz_haz_filter = item.hazard_filter.clone();
PlacedItem {
item_id: item.id,
d_transf,
shape,
hazard_filter: qz_haz_filter,
}
}
}