From 1ac8dd2828f54da638d4626e8e5e9c1bf6d2f639 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Thu, 31 Aug 2023 22:45:51 +0200 Subject: [PATCH] Only remove node when collision is detected during placement As the node is inserted into the R-tree only afterwards. --- src/layout.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layout.rs b/src/layout.rs index cb49082..d03261b 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1,10 +1,10 @@ use geo::Point; -use petgraph::stable_graph::{StableDiGraph}; +use petgraph::stable_graph::StableDiGraph; use petgraph::visit::EdgeRef; use petgraph::Direction::Incoming; use rstar::primitives::GeomWithData; use rstar::RTree; -use spade::{Triangulation}; +use spade::Triangulation; use crate::bow::Bow; use crate::graph::{ @@ -233,7 +233,7 @@ impl Layout { except: &[TaggedIndex], ) -> Result<(), ()> { if let Some(..) = self.detect_collision_except(index, except) { - self.remove(index); + self.graph.remove_node(index.index); return Err(()); } Ok(())