ifsnop/martinez-rueda-php
最新稳定版本:1.0.1
Composer 安装命令:
composer require ifsnop/martinez-rueda-php
包简介
Robust and tested library for boolean operations on polygons (union, intersection, difference, xor)
README 文档
README
Robust and tested library for boolean operations on polygons (union, intersection, difference, xor) in PHP.
Some improvements over other libraries: This one is tested (see end-to-end directory) and optimized to use polygons with large amount of vertex (ie, binary search when doing intersections between segments).
This library can use arrays with polygons, geojson strings or geojson files directly.
Resources
- To understand the algorithm, you can go here
- Based somewhat on the F. Martinez (2008) algorithm:
- Website
- A new algorithm for computing Boolean operations on polygons 2009 Research GateScience Direct
- A simple algorithm for Boolean operations on polygons 2013
Examples
Some tests and demo implementation inside tests.php, extended coverage with PHPUnit:
- php tests.php
- ./vendor/bin/phpunit tests/
- ./vendor/phpstan/phpstan/phpstan --error-format=raw
For profiling:
- check that xdebug module is available and loaded: php -m | grep xdebug
- launch php with xdebug enabled:
php
-dxdebug.mode=profile
-dxdebug.start_with_request=yes
-dxdebug.output_dir=xdebug-profiler/
tests.php
Tutorials and notes
- Interactive tutorial Polygon Clipping (Part 1)
- Interactive tutorial Polygon Clipping (Part 2)
- Notes on the Martinez-Rueda Polygon Clipping algorithm
- Let's build! Boolean operations of polygonsPart 1 - IntroductionPart 2 - Intersections
Improvements
History
- This library is a port for PHP of pypolybool
- Previoulsy, was a port for JS of polybooljs
- Help from a .NET port
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-05-10