Simplify `PartialHalfEdge::with_global_form`

This commit is contained in:
Hanno Braun 2022-11-05 21:50:29 +01:00
parent 5ccea9e80e
commit 18e1fb6eb3
3 changed files with 6 additions and 8 deletions

View File

@ -32,8 +32,7 @@ impl TransformObject for PartialHalfEdge {
.global_form()
.into_partial()
.transform(transform, objects)?
.with_curve(curve.global_form())
.into();
.with_curve(curve.global_form());
Ok(Self::default()
.with_curve(curve)

View File

@ -89,7 +89,7 @@ impl<'a> ShellBuilder<'a> {
.zip(&surfaces)
.map(|(half_edge, surface)| {
HalfEdge::partial()
.with_global_form(Some(half_edge.global_form().clone()))
.with_global_form(half_edge.global_form().clone())
.update_as_line_segment_from_points(
surface.clone(),
[[Z, Z], [edge_length, Z]],
@ -252,7 +252,7 @@ impl<'a> ShellBuilder<'a> {
edges.push(
HalfEdge::partial()
.with_vertices(vertices)
.with_global_form(Some(edge.global_form().clone()))
.with_global_form(edge.global_form().clone())
.update_as_line_segment()
.build(self.objects)
.unwrap(),

View File

@ -107,11 +107,10 @@ impl PartialHalfEdge {
/// Update the partial half-edge with the given global form
pub fn with_global_form(
mut self,
global_form: Option<impl Into<MaybePartial<GlobalEdge>>>,
global_form: impl Into<MaybePartial<GlobalEdge>>,
) -> Self {
if let Some(global_form) = global_form {
self.global_form = global_form.into();
}
self
}