From 7dfc55c514d5c307452de248dc63513dbfd63607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Wed, 22 Dec 2021 19:05:52 +0000 Subject: [PATCH] Formatted, and better comment --- geo/src/algorithm/intersects/polygon.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/geo/src/algorithm/intersects/polygon.rs b/geo/src/algorithm/intersects/polygon.rs index 86b4d23d61..1e85ac50e6 100644 --- a/geo/src/algorithm/intersects/polygon.rs +++ b/geo/src/algorithm/intersects/polygon.rs @@ -57,16 +57,14 @@ where geo_types::Line: RTreeObject, { fn intersects(&self, polygon: &Polygon) -> bool { - // switch to querying trees above some threshold x: polygons' combined segment count is higher than x - if (self.exterior().0.len() - + self.interiors().iter().map(|ls| ls.0.len()).sum::()) - * - (polygon.exterior().0.len() - + polygon - .interiors() - .iter() - .map(|ls| ls.0.len()) - .sum::()) + // switch to querying trees above some threshold x: poly_a * poly_b segment count is higher than x + if (self.exterior().0.len() + self.interiors().iter().map(|ls| ls.0.len()).sum::()) + * (polygon.exterior().0.len() + + polygon + .interiors() + .iter() + .map(|ls| ls.0.len()) + .sum::()) > MAX_NAIVE_SEGMENTS { let lines_a: Vec<_> = self