PHP Classes

additional function

Recommend this page to a friend!

      Polygon  >  All threads  >  additional function  >  (Un) Subscribe thread alerts  
Subject:additional function
Summary:isPolyIntersect
Messages:1
Author:chad leverington
Date:2009-03-20 03:27:48
 

  1. additional function   Reply   Report abuse  
Picture of chad leverington chad leverington - 2009-03-20 03:27:48
this function returns true if two polygons intersect at any point (they overlap)

function isPolyIntersect (&$p)
{
$intersect = FALSE;
$c =& $p->getFirst(); // Get the first vertex in polygon $p
$s =& $this->getFirst(); // Get the first vertex in this polygon
do
{
do
{
if ($this->ints($s, $s->Next(),$c, $c->Next(), $n, $x, $y, $aS, $aC))
$intersect = TRUE;
$c =& $c->Next();
}
while ($c->id() != $p->first->id());
$s =& $s->Next();
}
while ($s->id() != $this->first->id());
return $intersect;
}