[mapserver-users] RE: drawing acetate shapes with PHP/Mapscript

Puneet Kishor pkishor at GeoAnalytics.com
Thu Apr 25 19:19:21 PDT 2002


one more... drawing a circle at origin x0, y0, with radius r

the following code works for me...

==========

$x0 = 250; $y0 = 250; $r = 5000;

[.. create various objects ..]

for($y = -$r; $y < $r; $y++) {
  $x = sqrt(($r*$r) - ($y*$y));
  $xtemp = $x0 + $x; $ytemp = $y0 + $y;
  $lineObj->addXY($xtemp, $ytemp);
}

for($y = -$r; $y < $r; $y++) {
  $x = sqrt(($r*$r) - ($y*$y));
  $xtemp = $x0 - $x; $ytemp = $y0 - $y;
  $lineObj->addXY($xtemp, $ytemp);
}

$shpObj->add($lineObj);

==========


surely, there has to be some better way than this kludge.

tia,

pk/



More information about the MapServer-users mailing list