Пример #1
0
function calcdist($sys1, $sys2)
{
    //Pour avoir l'abscisse des coordonnées du système 1 [syst1 = 2456 ax = 2456%100]
    //Pour avoir l'ordonée des coordonnées du système 1 [syst1 = 2456 ay = (2456-2456%100)/100]
    list($syst1y, $syst1x) = map::ss2xy($sys1);
    list($syst2y, $syst2x) = map::ss2xy($sys2);
    return round(round(round(sqrt(carre($syst1x - $syst2x) + carre($syst1y - $syst2y)), 2), 1), 0);
}
Пример #2
0
 public function path($CoordA, $CoordB)
 {
     list($sX, $sY) = map::ss2xy($CoordA);
     list($sX2, $sY2) = map::ss2xy($CoordB);
     $x1 = floor($this->tc * $sX - $this->tc / 2);
     $y1 = floor($this->tc * ($sY + 1) - $this->tc / 2);
     $x2 = floor($this->tc * $sX2 - $this->tc / 2);
     $y2 = floor($this->tc * ($sY2 + 1) - $this->tc / 2);
     imageline($this->im, $x1, $y1, $x2, $y2, $this->color);
 }
Пример #3
0
function img_dot($image, $coord, $clr)
{
    $tc = map::getinstance()->taille / 100;
    $td = floor($tc / 2);
    $td = $td % 2 ? $td + 3 : $td + 2;
    list($sX, $sY) = map::ss2xy($coord);
    $x1 = floor($tc * $sX - $tc / 2);
    $y1 = floor($tc * ($sY + 1) - $tc / 2);
    imagefilledellipse($image, $x1, $y1, $td, $td, $clr);
}
Пример #4
0
 public function GetListeCoorByRay($SS, $max_dist)
 {
     // 4890 = 90:48
     // 1 = 0001 = 1: 0
     // 10000 = 100: 0
     list($x, $y) = map::ss2xy($SS);
     // Warn: x/y s'inverse ;)
     $lst = array();
     for ($a = 0 - $max_dist; $a <= 0 + $max_dist; $a++) {
         for ($b = 0 - $max_dist; $b <= 0 + $max_dist; $b++) {
             $y1 = $b + $y;
             $x1 = $a + $x;
             $out = $y1 * 100 + $x1;
             if ($y1 < 0 || $y1 > 99) {
                 continue;
             }
             if ($x1 < 1 || $x1 > 100) {
                 continue;
             }
             if ($x1 == 100) {
                 $x1 = 0;
             }
             $out = $y1 * 100 + $x1;
             if ($this->Calcul_Distance($SS, $out) < $max_dist) {
                 $lst[] = $out;
             }
         }
     }
     return $lst;
 }