Add BuildSketch::circle

This commit is contained in:
Hanno Braun 2024-05-27 14:42:05 +02:00
parent e861a511bc
commit 5d230a6e7e

View File

@ -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,24 @@ pub trait BuildSketch {
fn empty(topology: &Topology) -> Sketch {
Sketch::new(topology.surfaces.space_2d(), [])
}
/// Build a circle
fn circle(
center: impl Into<Point<2>>,
radius: impl Into<Scalar>,
core: &mut Core,
) -> Sketch {
let sketch = Sketch::empty(&core.layers.topology);
sketch.add_regions(
[Region::circle(
center,
radius,
sketch.surface().clone(),
core,
)],
core,
)
}
}
impl BuildSketch for Sketch {}