Skip to content

Commit

Permalink
Add BuildSketch::polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 27, 2024
1 parent 5d230a6 commit 25ab473
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/fj-core/src/operations/build/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ pub trait BuildSketch {
core,
)
}

/// Build a polygon
fn polygon<P, Ps>(points: Ps, core: &mut Core) -> Sketch
where
P: Into<Point<2>>,
Ps: IntoIterator<Item = P>,
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 {}

0 comments on commit 25ab473

Please sign in to comment.