hannesvdvreken/pip
最新稳定版本:1.1.0
Composer 安装命令:
composer require hannesvdvreken/pip
包简介
The Polygon class
README 文档
README
A point-in-polygon algorithm, centroid and orientation calculation, written in PHP. Figure out (pun) if a point is actually inside a convex or concave polygon.
Usage
Initiate a Polygon object with coordinates as specified in the GeoJSON Format. An array of latitude, longitude pairs.
$coords = [ [51.046945330263, 3.7388005491447], [50.884119340619, 4.7054353759129], [51.260385196697, 4.3696193284848], ]; $poly = new \Geometry\Polygon($coords); $coords = $poly->getOutline(); $poly->setOutline($coords); $centroid = $poly->centroid(); echo "the centroid of the polygon is ($centroid[0], $centroid[1]).\n"; if ($poly->isValid()) { echo "the polygon was succesfully created.\n"; } if (!$poly->isClockwise()) { echo "the points define a counter-clockwise polygon.\n"; } if ($poly->pip($x, $y)) { echo "the polygon includes ($x,$y).\n"; }
Origin
Written during Apps For Ghent, 2012.
License
统计信息
- 总下载量: 38.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-09-08