mirror of https://github.com/hannobraun/Fornjot
Update order of code
This commit is contained in:
parent
a79bd1a7c2
commit
23fe9a5156
|
@ -14,28 +14,16 @@ pub struct PartialCycle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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`]
|
/// Access the half-edges that make up the [`Cycle`]
|
||||||
pub fn half_edges(&self) -> impl Iterator<Item = MaybePartial<HalfEdge>> {
|
pub fn half_edges(&self) -> impl Iterator<Item = MaybePartial<HalfEdge>> {
|
||||||
self.half_edges.clone().into_iter()
|
self.half_edges.clone().into_iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the partial cycle with the given surface
|
/// Access the surface that the [`Cycle`] is defined in
|
||||||
pub fn with_surface(mut self, surface: Option<Handle<Surface>>) -> Self {
|
pub fn surface(&self) -> Option<Handle<Surface>> {
|
||||||
if let Some(surface) = surface {
|
self.half_edges
|
||||||
for half_edge in &mut self.half_edges {
|
.first()
|
||||||
*half_edge = half_edge.clone().update_partial(|half_edge| {
|
.and_then(|half_edge| half_edge.curve().surface())
|
||||||
half_edge.with_surface(Some(surface.clone()))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the partial cycle with the given half-edges
|
/// Update the partial cycle with the given half-edges
|
||||||
|
@ -54,6 +42,18 @@ impl PartialCycle {
|
||||||
self.with_surface(surface)
|
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
|
/// Merge this partial object with another
|
||||||
pub fn merge_with(self, other: Self) -> Self {
|
pub fn merge_with(self, other: Self) -> Self {
|
||||||
let a_is_empty = self.half_edges.is_empty();
|
let a_is_empty = self.half_edges.is_empty();
|
||||||
|
|
Loading…
Reference in New Issue