From 041e6611b5d310144803616d4dfd02d551b06a6a Mon Sep 17 00:00:00 2001 From: Gaute Hope Date: Sat, 17 Aug 2024 13:14:40 +0200 Subject: [PATCH] fix idx confusion --- .../index/rstar_edge_set_intersector.rs | 18 ++++++++++++++---- .../index/simple_edge_set_intersector.rs | 7 +------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/geo/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs b/geo/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs index eed9986b5c..8c767849ae 100644 --- a/geo/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs +++ b/geo/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs @@ -26,8 +26,8 @@ where let edge_0 = &mut edges[segment_0.edge_idx]; segment_intersector.add_intersections_against_self( edge_0, - segment_0.edge_idx, - segment_1.edge_idx, + segment_0.segment_idx, + segment_1.segment_idx, ); } else { // XXX: use get_many_mut when available. @@ -42,9 +42,19 @@ where let edge_1 = &mut e1[mx - (mi + 1)]; if segment_0.edge_idx > segment_1.edge_idx { - segment_intersector.add_intersections(edge_1, mx, edge_0, mi); + segment_intersector.add_intersections( + edge_1, + segment_0.segment_idx, + edge_0, + segment_1.segment_idx, + ); } else { - segment_intersector.add_intersections(edge_0, mi, edge_1, mx); + segment_intersector.add_intersections( + edge_0, + segment_0.segment_idx, + edge_1, + segment_1.segment_idx, + ); } } } diff --git a/geo/src/algorithm/relate/geomgraph/index/simple_edge_set_intersector.rs b/geo/src/algorithm/relate/geomgraph/index/simple_edge_set_intersector.rs index c8524c0d32..c7ce3da466 100644 --- a/geo/src/algorithm/relate/geomgraph/index/simple_edge_set_intersector.rs +++ b/geo/src/algorithm/relate/geomgraph/index/simple_edge_set_intersector.rs @@ -50,11 +50,10 @@ impl EdgeSetIntersector for SimpleEdgeSetIntersector { segment_intersector: &mut SegmentIntersector, ) { let edges = graph.edges_mut(); - let mut checks = 0; for i in 0..edges.len() { let (e0, e1) = edges.split_at_mut(i + 1); let (e0, edge0) = e0.split_at_mut(i); - assert_eq!(edge0.len(), 1); + debug_assert_eq!(edge0.len(), 1); let edge0 = &mut edge0[0]; if check_for_self_intersecting_edges { @@ -63,12 +62,8 @@ impl EdgeSetIntersector for SimpleEdgeSetIntersector { for edge1 in e0.iter_mut().chain(e1) { self.compute_intersects(edge0, edge1, segment_intersector); - checks += 1; } } - - println!("checks: {}", checks); - assert_eq!(checks, edges.len()*edges.len()); } fn compute_intersections_between_sets<'a>(