Skip to content

Commit

Permalink
Simplify polygon intersects coord
Browse files Browse the repository at this point in the history
  • Loading branch information
b4l committed Aug 24, 2023
1 parent 3b70fe6 commit 6f838a5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions geo/src/algorithm/intersects/polygon.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{has_disjoint_bboxes, Intersects};
use crate::utils::{coord_pos_relative_to_ring, CoordPos};
use crate::BoundingRect;
use crate::coordinate_position::CoordPos;
use crate::{BoundingRect, CoordinatePosition};
use crate::{
Coord, CoordNum, GeoNum, Line, LineString, MultiLineString, MultiPolygon, Point, Polygon, Rect,
Triangle,
Expand All @@ -11,11 +11,7 @@ where
T: GeoNum,
{
fn intersects(&self, p: &Coord<T>) -> bool {
coord_pos_relative_to_ring(*p, self.exterior()) != CoordPos::Outside
&& self
.interiors()
.iter()
.all(|int| coord_pos_relative_to_ring(*p, int) != CoordPos::Inside)
self.coordinate_position(p) != CoordPos::Outside
}
}
symmetric_intersects_impl!(Coord<T>, Polygon<T>);
Expand Down

0 comments on commit 6f838a5

Please sign in to comment.