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() .global_form()
.into_partial() .into_partial()
.transform(transform, objects)? .transform(transform, objects)?
.with_curve(curve.global_form()) .with_curve(curve.global_form());
.into();
Ok(Self::default() Ok(Self::default()
.with_curve(curve) .with_curve(curve)

View File

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

View File

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