rectangle_pack/
packed_location.rs

1use crate::width_height_depth::WidthHeightDepth;
2
3/// Describes how and where an incoming rectangle was packed into the target bins
4#[derive(Debug, PartialEq, Copy, Clone)]
5pub struct PackedLocation {
6    pub(crate) x: u32,
7    pub(crate) y: u32,
8    pub(crate) z: u32,
9    pub(crate) whd: WidthHeightDepth,
10    pub(crate) x_axis_rotation: RotatedBy,
11    pub(crate) y_axis_rotation: RotatedBy,
12    pub(crate) z_axis_rotation: RotatedBy,
13}
14
15#[derive(Debug, PartialEq, Copy, Clone)]
16#[allow(unused)] // TODO: Implement rotations
17pub enum RotatedBy {
18    ZeroDegrees,
19    NinetyDegrees,
20}
21
22#[allow(missing_docs)]
23impl PackedLocation {
24    pub fn x(&self) -> u32 {
25        self.x
26    }
27
28    pub fn y(&self) -> u32 {
29        self.y
30    }
31
32    pub fn z(&self) -> u32 {
33        self.z
34    }
35
36    pub fn width(&self) -> u32 {
37        self.whd.width
38    }
39
40    pub fn height(&self) -> u32 {
41        self.whd.height
42    }
43
44    pub fn depth(&self) -> u32 {
45        self.whd.depth
46    }
47}