From 5f3823064caa94f19aa584fb1421e5a791d7fdbf Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 18 Mar 2024 12:30:39 +0100 Subject: [PATCH 1/2] Update variable name --- crates/fj-core/src/algorithms/approx/edge.rs | 42 ++++++++++++-------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index 88decf722..86ecc5b6a 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -22,31 +22,41 @@ impl Approx for (&HalfEdge, &SurfaceGeometry) { cache: &mut Self::Cache, core: &mut Core, ) -> Self::Approximation { - let (edge, surface) = self; + let (half_edge, surface) = self; let tolerance = tolerance.into(); - let start_position_surface = edge.start_position(); - let start_position = match cache.start_position.get(edge.start_vertex()) - { - Some(position) => position, - None => { - let position_global = - surface.point_from_surface_coords(start_position_surface); - cache - .start_position - .insert(edge.start_vertex().clone(), position_global) - } - }; + let start_position_surface = half_edge.start_position(); + let start_position = + match cache.start_position.get(half_edge.start_vertex()) { + Some(position) => position, + None => { + let position_global = surface + .point_from_surface_coords(start_position_surface); + cache.start_position.insert( + half_edge.start_vertex().clone(), + position_global, + ) + } + }; let first = ApproxPoint::new(start_position_surface, start_position); let rest = { - let approx = (edge.curve(), edge.path(), surface, edge.boundary()) - .approx_with_cache(tolerance, &mut cache.curve, core); + let approx = ( + half_edge.curve(), + half_edge.path(), + surface, + half_edge.boundary(), + ) + .approx_with_cache( + tolerance, + &mut cache.curve, + core, + ); approx.points.into_iter().map(|point| { let point_surface = - edge.path().point_from_path_coords(point.local_form); + half_edge.path().point_from_path_coords(point.local_form); ApproxPoint::new(point_surface, point.global_form) }) From 4d1c0c3239b52eb83d5ab375a9fce8a533335333 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 18 Mar 2024 12:33:12 +0100 Subject: [PATCH 2/2] Update argument name --- crates/fj-core/src/algorithms/approx/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index cfa546d7b..131bf134f 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -29,8 +29,8 @@ impl Approx for (&Cycle, &SurfaceGeometry) { let half_edges = cycle .half_edges() .iter() - .map(|edge| { - (edge.deref(), surface) + .map(|half_edge| { + (half_edge.deref(), surface) .approx_with_cache(tolerance, cache, core) }) .collect();