Skip to content

Commit

Permalink
Formatted, and better comment
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Dec 22, 2021
1 parent 6e03e49 commit 7dfc55c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions geo/src/algorithm/intersects/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ where
geo_types::Line<T>: RTreeObject,
{
fn intersects(&self, polygon: &Polygon<T>) -> 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::<usize>())
*
(polygon.exterior().0.len()
+ polygon
.interiors()
.iter()
.map(|ls| ls.0.len())
.sum::<usize>())
// 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::<usize>())
* (polygon.exterior().0.len()
+ polygon
.interiors()
.iter()
.map(|ls| ls.0.len())
.sum::<usize>())
> MAX_NAIVE_SEGMENTS
{
let lines_a: Vec<_> = self
Expand Down

0 comments on commit 7dfc55c

Please sign in to comment.