jagua_rs/entities/
item.rsuse std::sync::Arc;
use crate::collision_detection::hazard_filter::QZHazardFilter;
use crate::geometry::geo_enums::AllowedRotation;
use crate::geometry::primitives::simple_polygon::SimplePolygon;
use crate::geometry::transformation::Transformation;
use crate::util::config::SPSurrogateConfig;
#[derive(Clone, Debug)]
pub struct Item {
pub id: usize,
pub shape: Arc<SimplePolygon>,
pub allowed_rotation: AllowedRotation,
pub base_quality: Option<usize>,
pub value: u64,
pub pretransform: Transformation,
pub hazard_filter: Option<QZHazardFilter>,
pub surrogate_config: SPSurrogateConfig,
}
impl Item {
pub fn new(
id: usize,
mut shape: SimplePolygon,
allowed_rotation: AllowedRotation,
base_quality: Option<usize>,
value: u64,
pretransform: Transformation,
surrogate_config: SPSurrogateConfig,
) -> Item {
shape.generate_surrogate(surrogate_config);
let shape = Arc::new(shape);
let hazard_filter = base_quality.map(QZHazardFilter);
Item {
id,
shape,
allowed_rotation,
base_quality,
value,
pretransform,
hazard_filter,
surrogate_config,
}
}
}