From d0eb0b2df1bab4e1b276855d2a861c028cc5719e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 12 Jun 2023 12:41:09 +0200 Subject: [PATCH] Add `UpdateSketch::add_circle` --- .../fj-core/src/operations/update/sketch.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/fj-core/src/operations/update/sketch.rs b/crates/fj-core/src/operations/update/sketch.rs index faeff727b..42f518cb8 100644 --- a/crates/fj-core/src/operations/update/sketch.rs +++ b/crates/fj-core/src/operations/update/sketch.rs @@ -1,4 +1,4 @@ -use fj_math::Point; +use fj_math::{Point, Scalar}; use crate::{ geometry::region::Region, @@ -12,6 +12,14 @@ pub trait UpdateSketch { /// Add a region to the sketch fn add_region(&self, region: Region) -> Self; + /// Add a circle to the sketch + fn add_circle( + &self, + center: impl Into>, + radius: impl Into, + services: &mut Services, + ) -> Self; + /// Add a polygon to the sketch fn add_polygon(&self, points: Ps, services: &mut Services) -> Self where @@ -25,6 +33,16 @@ impl UpdateSketch for Sketch { Sketch::new(self.regions().cloned().chain([region])) } + fn add_circle( + &self, + center: impl Into>, + radius: impl Into, + services: &mut Services, + ) -> Self { + let exterior = Cycle::circle(center, radius, services).insert(services); + self.add_region(Region::new(exterior, [], None)) + } + fn add_polygon(&self, points: Ps, services: &mut Services) -> Self where P: Into>,