Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
52188: geogfn: optimize polygon covers point r=sumeerbhola a=otan

A polygon that intersects with a point must be a covering.

Release note: None

Co-authored-by: Oliver Tan <[email protected]>
  • Loading branch information
craig[bot] and otan committed Aug 3, 2020
2 parents b06f42c + 8954bc9 commit b0ec3c9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/geo/geogfn/covers.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ func polylineCoversPointWithIdx(a *s2.Polyline, b s2.Point) (bool, int) {

// polygonCoversPoints returns whether a polygon covers a given point.
func polygonCoversPoint(a *s2.Polygon, b s2.Point) bool {
// Account for the case where b is on the edge of the polygon.
return a.ContainsPoint(b) || a.IntersectsCell(s2.CellFromPoint(b))
return a.IntersectsCell(s2.CellFromPoint(b))
}

// edgeCoversPoint determines whether a given edge contains a point.
Expand Down

0 comments on commit b0ec3c9

Please sign in to comment.