Skip to content

Commit

Permalink
Update order of code
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 4, 2022
1 parent a79bd1a commit 23fe9a5
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions crates/fj-kernel/src/partial/objects/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,16 @@ pub struct PartialCycle {
}

impl PartialCycle {
/// Access the surface that the [`Cycle`] is defined in
pub fn surface(&self) -> Option<Handle<Surface>> {
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<Item = MaybePartial<HalfEdge>> {
self.half_edges.clone().into_iter()
}

/// Update the partial cycle with the given surface
pub fn with_surface(mut self, surface: Option<Handle<Surface>>) -> 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<Handle<Surface>> {
self.half_edges
.first()
.and_then(|half_edge| half_edge.curve().surface())
}

/// Update the partial cycle with the given half-edges
Expand All @@ -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<Handle<Surface>>) -> 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();
Expand Down

0 comments on commit 23fe9a5

Please sign in to comment.