jagua_rs/entities/
placing_option.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::entities::placed_item::PlacedItem;
use crate::entities::problems::problem_generic::LayoutIndex;
use crate::geometry::d_transformation::DTransformation;

#[derive(Clone, Debug, Copy)]
/// Encapsulates all required information to place an `Item` in a `Problem`
pub struct PlacingOption {
    /// Which layout to place the item in
    pub layout_idx: LayoutIndex,
    /// The id of the item to be placed
    pub item_id: usize,
    /// The decomposition of the transformation
    pub d_transf: DTransformation,
}

impl PlacingOption {
    pub fn from_placed_item(layout_idx: LayoutIndex, placed_item: &PlacedItem) -> Self {
        PlacingOption {
            layout_idx,
            item_id: placed_item.item_id,
            d_transf: placed_item.d_transf,
        }
    }
}