Skip to content

Commit

Permalink
Provide &Handle<Surface> to half-edge approx
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Mar 26, 2024
1 parent 757a398 commit 35d763c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions crates/fj-core/src/algorithms/approx/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ impl Approx for (&Cycle, &Handle<Surface>) {
.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();

Expand Down
13 changes: 9 additions & 4 deletions crates/fj-core/src/algorithms/approx/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
//! 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::{
curve::CurveApproxCache, vertex::VertexApproxCache, Approx, ApproxPoint,
Tolerance,
};

impl Approx for (&Handle<HalfEdge>, &SurfaceGeometry) {
impl Approx for (&Handle<HalfEdge>, &Handle<Surface>) {
type Approximation = HalfEdgeApprox;
type Cache = HalfEdgeApproxCache;

Expand All @@ -36,7 +38,10 @@ impl Approx for (&Handle<HalfEdge>, &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(),
Expand All @@ -51,7 +56,7 @@ impl Approx for (&Handle<HalfEdge>, &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,
Expand Down

0 comments on commit 35d763c

Please sign in to comment.