This commit is contained in:
Josh Deprez 2021-09-09 10:17:33 +10:00
parent d3527d192f
commit e11f199d53

View file

@ -2,7 +2,9 @@ package geom
import "image"
// PolygonContains reports if a polygon contains a point
// PolygonContains reports if a polygon contains a point. The polygon must be in
// clockwise order if +Y is pointing upwards, or anticlockwise if +Y is pointing
// downwards.
func PolygonContains(polygon []image.Point, p image.Point) bool {
for i, q := range polygon {
r := polygon[(i+1)%len(polygon)]