From 23fe9a5156aaeca8c8545360e5893b2f845583df Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 4 Nov 2022 15:33:58 +0100 Subject: [PATCH] Update order of code --- crates/fj-kernel/src/partial/objects/cycle.rs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) 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();