Simplify `PartialHalfEdge::with_curve`

This commit is contained in:
Hanno Braun 2022-11-05 21:46:40 +01:00
parent 076400632c
commit 421e03efda
5 changed files with 8 additions and 15 deletions

View File

@ -36,7 +36,7 @@ impl TransformObject for PartialHalfEdge {
.into();
Ok(Self::default()
.with_curve(Some(curve))
.with_curve(curve)
.with_vertices(Some(vertices))
.with_global_form(global_form))
}

View File

@ -81,7 +81,7 @@ impl CycleBuilder for PartialCycle {
half_edges.push(
HalfEdge::partial()
.with_curve(Some(curve))
.with_curve(curve)
.with_vertices(Some([from, to])),
);

View File

@ -79,9 +79,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
.with_surface_form(surface_vertex.clone())
});
Ok(self
.with_curve(Some(curve))
.with_vertices(Some([back, front])))
Ok(self.with_curve(curve).with_vertices(Some([back, front])))
}
fn update_as_line_segment_from_points(
@ -181,8 +179,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
})
};
self.with_curve(Some(curve))
.with_vertices(Some([back, front]))
self.with_curve(curve).with_vertices(Some([back, front]))
}
}

View File

@ -148,7 +148,7 @@ impl<'a> ShellBuilder<'a> {
));
HalfEdge::partial()
.with_curve(Some(curve))
.with_curve(curve)
.with_vertices(Some([
Vertex::partial().with_surface_form(from),
Vertex::partial().with_surface_form(to),

View File

@ -67,13 +67,9 @@ impl PartialHalfEdge {
}
/// Update the partial half-edge with the given curve
pub fn with_curve(
mut self,
curve: Option<impl Into<MaybePartial<Curve>>>,
) -> Self {
if let Some(curve) = curve {
self.curve = curve.into();
}
pub fn with_curve(mut self, curve: impl Into<MaybePartial<Curve>>) -> Self {
self.curve = curve.into();
self
}