Skip to content

Commit

Permalink
Make UpdateFace::update_region more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jun 13, 2023
1 parent c24ebc6 commit f8450c3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/fj-core/src/operations/update/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,27 @@ use crate::{
/// Update a [`Face`]
pub trait UpdateFace {
/// Replace the region of the face
fn update_region(&self, f: impl FnOnce(&Region) -> Handle<Region>) -> Self;
fn update_region(
&self,
f: impl FnOnce(&Handle<Region>) -> Handle<Region>,
) -> Self;
}

impl UpdateFace for Face {
fn update_region(&self, f: impl FnOnce(&Region) -> Handle<Region>) -> Self {
fn update_region(
&self,
f: impl FnOnce(&Handle<Region>) -> Handle<Region>,
) -> Self {
let region = f(self.region());
Face::new(self.surface().clone(), region)
}
}

impl<const D: usize> UpdateFace for Polygon<D> {
fn update_region(&self, f: impl FnOnce(&Region) -> Handle<Region>) -> Self {
fn update_region(
&self,
f: impl FnOnce(&Handle<Region>) -> Handle<Region>,
) -> Self {
let face = self.face.update_region(f);
let edges = array::from_fn(|i| {
face.region()
Expand Down

0 comments on commit f8450c3

Please sign in to comment.