1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::{BinaryImage, Bound, BoundingRect};

/// An artificial object that have a shape and a position in space
#[derive(Debug, Default)]
pub struct Artifact {
    /// shape image
    pub image: BinaryImage,
    /// position in space
    pub bound: BoundingRect,
}

impl Artifact {
    pub fn new(rect: BoundingRect, image: BinaryImage) -> Self {
        Self {
            bound: rect,
            image,
        }
    }
}

impl Bound for Artifact {
    fn bound(&self) -> BoundingRect {
        self.bound
    }
}