Skip to content

Commit

Permalink
Simplify CycleBuilder method
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Dec 16, 2022
1 parent abbf309 commit be09ca5
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions crates/fj-kernel/src/builder/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,18 @@ impl CycleBuilder for PartialCycle {
points: impl IntoIterator<Item = impl Into<Point<2>>>,
) -> Vec<Partial<HalfEdge>> {
let surface = surface.into();
let points = points.into_iter().map(Into::into);
let mut points = points.into_iter().map(Into::into);

let mut half_edges = Vec::new();

for point in points {
let mut half_edge = self.add_half_edge();

{
let mut half_edge = half_edge.write();

half_edge.curve().write().surface = surface.clone();

let mut back = half_edge.back_mut().write();
let mut back_surface = back.surface_form.write();

back_surface.position = Some(point);
back_surface.surface = surface.clone();
}
if let Some(point) = points.next() {
let mut half_edge = self.add_half_edge_from_point_to_start(point);
half_edge.write().replace_surface(surface);
half_edges.push(half_edge);
}

for point in points {
let half_edge = self.add_half_edge_from_point_to_start(point);
half_edges.push(half_edge);
}

Expand Down

0 comments on commit be09ca5

Please sign in to comment.