diff --git a/crates/fj-core/src/operations/build/sketch.rs b/crates/fj-core/src/operations/build/sketch.rs index 93e8a6840..25edbe263 100644 --- a/crates/fj-core/src/operations/build/sketch.rs +++ b/crates/fj-core/src/operations/build/sketch.rs @@ -1,4 +1,12 @@ -use crate::topology::{Sketch, Topology}; +use fj_math::{Point, Scalar}; + +use crate::{ + operations::update::UpdateSketch, + topology::{Region, Sketch, Topology}, + Core, +}; + +use super::BuildRegion; /// Build a [`Sketch`] /// @@ -10,6 +18,38 @@ pub trait BuildSketch { fn empty(topology: &Topology) -> Sketch { Sketch::new(topology.surfaces.space_2d(), []) } + + /// Build a circle + fn circle( + center: impl Into>, + radius: impl Into, + core: &mut Core, + ) -> Sketch { + let sketch = Sketch::empty(&core.layers.topology); + sketch.add_regions( + [Region::circle( + center, + radius, + sketch.surface().clone(), + core, + )], + core, + ) + } + + /// Build a polygon + fn polygon(points: Ps, core: &mut Core) -> Sketch + where + P: Into>, + Ps: IntoIterator, + Ps::IntoIter: Clone + ExactSizeIterator, + { + let sketch = Sketch::empty(&core.layers.topology); + sketch.add_regions( + [Region::polygon(points, sketch.surface().clone(), core)], + core, + ) + } } impl BuildSketch for Sketch {}