pepin82 / geometry
point-in-polygon algorithm
Installs: 275
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/pepin82/geometry
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2025-11-05 00:22:10 UTC
README
Point In Polygon Algorithm, based on Michaël Niessen implementation [http://assemblysys.com/php-point-in-polygon-algorithm/]
Usage
use \Geometry\Point; use \Geometry\Points; use \Geometry\Polygon; $polygon = new Polygon(new Points(array( new Point(-1, -1), new Point(-1, 1), new Point(1, 1), new Point(1, -1), new Point(-1, -1) ))); if($polygon->contains(new Point(0, 0))) { echo "point is contained in polygon"; } else { echo "point isn't contained in polygon"; }