
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;
}