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
26
27
28
29
30
31
32
use fj_math::Point;
use crate::{
objects::Surface,
partial::{Partial, PartialFace, PartialSketch},
};
use super::FaceBuilder;
pub trait SketchBuilder {
fn add_polygon_from_points(
&mut self,
surface: impl Into<Partial<Surface>>,
points: impl IntoIterator<Item = impl Into<Point<2>>>,
);
}
impl SketchBuilder for PartialSketch {
fn add_polygon_from_points(
&mut self,
surface: impl Into<Partial<Surface>>,
points: impl IntoIterator<Item = impl Into<Point<2>>>,
) {
let mut face = PartialFace::default();
face.exterior.write().surface = surface.into();
face.update_exterior_as_polygon_from_points(points);
self.faces.extend([Partial::from_partial(face)]);
}
}