mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 21:08:27 +00:00
Add BuildSketch::circle
This commit is contained in:
parent
e861a511bc
commit
5d230a6e7e
@ -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 {}
|
||||
|
Loading…
Reference in New Issue
Block a user