From 35d763c18bcaa0716755408ec016e834742c662d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 25 Mar 2024 13:15:34 +0100 Subject: [PATCH] Provide `&Handle` to half-edge approx --- crates/fj-core/src/algorithms/approx/cycle.rs | 3 +-- crates/fj-core/src/algorithms/approx/edge.rs | 13 +++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index 59d9bddc8..fd4311231 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -32,8 +32,7 @@ impl Approx for (&Cycle, &Handle) { .half_edges() .iter() .map(|half_edge| { - (half_edge, &core.layers.geometry.of_surface(surface)) - .approx_with_cache(tolerance, cache, core) + (half_edge, surface).approx_with_cache(tolerance, cache, core) }) .collect(); diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index 0484ea7b9..e668fb119 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -6,7 +6,9 @@ //! the caller doesn't have to deal with duplicate vertices. use crate::{ - geometry::SurfaceGeometry, storage::Handle, topology::HalfEdge, Core, + storage::Handle, + topology::{HalfEdge, Surface}, + Core, }; use super::{ @@ -14,7 +16,7 @@ use super::{ Tolerance, }; -impl Approx for (&Handle, &SurfaceGeometry) { +impl Approx for (&Handle, &Handle) { type Approximation = HalfEdgeApprox; type Cache = HalfEdgeApproxCache; @@ -36,7 +38,10 @@ impl Approx for (&Handle, &SurfaceGeometry) { match cache.start_position.get(half_edge.start_vertex()) { Some(position) => position, None => { - let position_global = surface + let position_global = core + .layers + .geometry + .of_surface(surface) .point_from_surface_coords(start_position_surface); cache.start_position.insert( half_edge.start_vertex().clone(), @@ -51,7 +56,7 @@ impl Approx for (&Handle, &SurfaceGeometry) { let approx = ( half_edge.curve(), &core.layers.geometry.of_half_edge(half_edge), - surface, + &core.layers.geometry.of_surface(surface), ) .approx_with_cache( tolerance,