fj_kernel/objects/full/
sketch.rs

1use crate::{
2    objects::{Face, FaceSet},
3    storage::Handle,
4};
5
6/// A 2-dimensional shape
7///
8/// # Implementation Note
9///
10/// The faces that make up the sketch must be in the same surface. This is not
11/// currently validated.
12#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
13pub struct Sketch {
14    faces: FaceSet,
15}
16
17impl Sketch {
18    /// Construct an empty instance of `Sketch`
19    pub fn new(faces: impl IntoIterator<Item = Handle<Face>>) -> Self {
20        Self {
21            faces: faces.into_iter().collect(),
22        }
23    }
24
25    /// Access the faces of the sketch
26    pub fn faces(&self) -> &FaceSet {
27        &self.faces
28    }
29}