From 674d33a6bac9409846295399b981169e23dca995 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 11 Nov 2022 16:53:02 +0100 Subject: [PATCH] Update builder method --- crates/fj-kernel/src/builder/edge.rs | 16 +++++++--------- crates/fj-kernel/src/builder/vertex.rs | 16 +++++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index 06468f3c8..74794c131 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -3,12 +3,9 @@ use iter_fixed::IntoIteratorFixed; use crate::{ insert::Insert, - objects::{ - Curve, GlobalVertex, Objects, Surface, Vertex, - VerticesInNormalizedOrder, - }, + objects::{Curve, Objects, Surface, Vertex, VerticesInNormalizedOrder}, partial::{ - HasPartial, MaybePartial, PartialCurve, PartialGlobalEdge, + MaybePartial, PartialCurve, PartialGlobalEdge, PartialGlobalVertex, PartialHalfEdge, PartialSurfaceVertex, PartialVertex, }, storage::Handle, @@ -82,10 +79,11 @@ impl HalfEdgeBuilder for PartialHalfEdge { .vertices() .map(|[global_form, _]| global_form) .unwrap_or_else(|| { - let mut global_vertex = GlobalVertex::partial(); - global_vertex - .update_from_curve_and_position(curve.clone(), a_curve); - global_vertex.into() + PartialGlobalVertex::from_curve_and_position( + curve.clone(), + a_curve, + ) + .into() }); let surface_vertex = PartialSurfaceVertex { diff --git a/crates/fj-kernel/src/builder/vertex.rs b/crates/fj-kernel/src/builder/vertex.rs index 88028756e..3328dcd1a 100644 --- a/crates/fj-kernel/src/builder/vertex.rs +++ b/crates/fj-kernel/src/builder/vertex.rs @@ -37,11 +37,10 @@ impl SurfaceVertexBuilder for PartialSurfaceVertex { /// Builder API for [`PartialGlobalVertex`] pub trait GlobalVertexBuilder { /// Update partial global vertex from the given curve and position on it - fn update_from_curve_and_position( - &mut self, + fn from_curve_and_position( curve: impl Into>, position: impl Into>, - ) -> &mut Self; + ) -> Self; /// Update partial global vertex from the given surface and position on it fn update_from_surface_and_position( @@ -52,11 +51,10 @@ pub trait GlobalVertexBuilder { } impl GlobalVertexBuilder for PartialGlobalVertex { - fn update_from_curve_and_position( - &mut self, + fn from_curve_and_position( curve: impl Into>, position: impl Into>, - ) -> &mut Self { + ) -> Self { let curve = curve.into().into_partial(); let path = curve.path.expect( @@ -67,7 +65,11 @@ impl GlobalVertexBuilder for PartialGlobalVertex { ); let position_surface = path.point_from_path_coords(position); - self.update_from_surface_and_position(&surface, position_surface) + + let mut global_vertex = PartialGlobalVertex::default(); + global_vertex + .update_from_surface_and_position(&surface, position_surface); + global_vertex } fn update_from_surface_and_position(