public function Polygon::isSimple in geoPHP 7
Same name and namespace in other branches
- 8 geoPHP/lib/geometry/Polygon.class.php \Polygon::isSimple()
Overrides Collection::isSimple
File
- geoPHP/
lib/ geometry/ Polygon.class.php, line 124
Class
- Polygon
- Polygon: A polygon is a plane figure that is bounded by a closed path, composed of a finite sequence of straight line segments
Code
public function isSimple() {
if ($this
->geos()) {
return $this
->geos()
->isSimple();
}
$segments = $this
->explode();
foreach ($segments as $i => $segment) {
foreach ($segments as $j => $check_segment) {
if ($i != $j) {
if ($segment
->lineSegmentIntersect($check_segment)) {
return FALSE;
}
}
}
}
return TRUE;
}