コード例 #1
0
ファイル: Polygon.php プロジェクト: edewaele/yapafo
 function isPolySelfIntersect()
 {
     $intersect = FALSE;
     $s = $this->getFirst();
     // Get the first vertex in this polygon
     $c = $s->Next();
     // Get the next vertex
     do {
         do {
             if ($this->ints($s, $s->Next(), $c, $c->Next(), $n, $x, $y, $aS, $aC)) {
                 // If the segments intersect
                 for ($i = 0; $i <= $n; $i++) {
                     // then for each intersection point
                     if (isset($aS[$i]) && $aS[$i] != 0 || isset($aC[$i]) && $aC[$i] != 0) {
                         // check that it NOT at the end of the segment
                         $intersect = TRUE;
                     }
                 }
             }
             // Because sequential segments always intersect at their ends
             $c = $c->Next();
         } while ($c->id() != $this->first->id());
         $s = $s->Next();
     } while ($s->id() != $this->first->id());
     return $intersect;
 }