diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index b4e55ef07..0c6a8fb16 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -14,28 +14,16 @@ pub struct PartialCycle { } impl PartialCycle { - /// Access the surface that the [`Cycle`] is defined in - pub fn surface(&self) -> Option> { - self.half_edges - .first() - .and_then(|half_edge| half_edge.curve().surface()) - } - /// Access the half-edges that make up the [`Cycle`] pub fn half_edges(&self) -> impl Iterator> { self.half_edges.clone().into_iter() } - /// Update the partial cycle with the given surface - pub fn with_surface(mut self, surface: Option>) -> Self { - if let Some(surface) = surface { - for half_edge in &mut self.half_edges { - *half_edge = half_edge.clone().update_partial(|half_edge| { - half_edge.with_surface(Some(surface.clone())) - }); - } - } - self + /// Access the surface that the [`Cycle`] is defined in + pub fn surface(&self) -> Option> { + self.half_edges + .first() + .and_then(|half_edge| half_edge.curve().surface()) } /// Update the partial cycle with the given half-edges @@ -54,6 +42,18 @@ impl PartialCycle { self.with_surface(surface) } + /// Update the partial cycle with the given surface + pub fn with_surface(mut self, surface: Option>) -> Self { + if let Some(surface) = surface { + for half_edge in &mut self.half_edges { + *half_edge = half_edge.clone().update_partial(|half_edge| { + half_edge.with_surface(Some(surface.clone())) + }); + } + } + self + } + /// Merge this partial object with another pub fn merge_with(self, other: Self) -> Self { let a_is_empty = self.half_edges.is_empty();