Skip to content

Commit

Permalink
fix idx confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
gauteh committed Aug 17, 2024
1 parent 675fab0 commit 5499af0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion geo/src/algorithm/relate/geomgraph/geometry_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ where
}

fn build_tree(&self) -> RTree<Segment<F>> {
println!("build tree");
let segments: Vec<Segment<F>> = self
.edges()
.iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ impl<F: GeoFloat> EdgeSetIntersector<F> for SimpleEdgeSetIntersector {
segment_intersector: &mut SegmentIntersector<F>,
) {
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 {
Expand All @@ -63,12 +62,8 @@ impl<F: GeoFloat> EdgeSetIntersector<F> 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>(
Expand Down

0 comments on commit 5499af0

Please sign in to comment.