Skip to content

Commit

Permalink
Add BuildFace::polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jun 27, 2023
1 parent cdcc30a commit ec0987c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions crates/fj-core/src/operations/build/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ pub trait BuildFace {
let (surface, points_surface) = Surface::plane_from_points(points);
let surface = surface.insert(services);

let region = Region::polygon(points_surface, services).insert(services);
let face = Face::new(surface, region);
let face = Face::polygon(surface, points_surface, services);

let edges = {
let mut half_edges = face.region().exterior().half_edges().cloned();
Expand All @@ -51,6 +50,21 @@ pub trait BuildFace {
vertices,
}
}

/// Build a polygon
fn polygon<P, Ps>(
surface: Handle<Surface>,
points: Ps,
services: &mut Services,
) -> Face
where
P: Into<Point<2>>,
Ps: IntoIterator<Item = P>,
Ps::IntoIter: Clone + ExactSizeIterator,
{
let region = Region::polygon(points, services).insert(services);
Face::new(surface, region)
}
}

impl BuildFace for Face {}
Expand Down

0 comments on commit ec0987c

Please sign in to comment.