예제 #1
0
파일: Cass.php 프로젝트: rldhont/proj4php
 public function inverse($p)
 {
     $p->x -= $this->x0;
     $p->y -= $this->y0;
     $x = $p->x / $this->a;
     $y = $p->y / $this->a;
     if ($this->sphere) {
         $this->dd = $y + $this->lat0;
         $phi = asin(sin($this->dd) * cos($x));
         $lam = atan2(tan($x), cos($this->dd));
     } else {
         // ellipsoid
         $ph1 = Common::pj_inv_mlfn($this->m0 + $y, $this->es, $this->en);
         $this->tn = tan($ph1);
         $this->t = $this->tn * $this->tn;
         $this->n = sin($ph1);
         $this->r = 1.0 / (1.0 - $this->es * $this->n * $this->n);
         $this->n = sqrt($this->r);
         $this->r *= (1.0 - $this->es) * $this->n;
         $this->dd = $x / $this->n;
         $this->d2 = $this->dd * $this->dd;
         $phi = $ph1 - $this->n * $this->tn / $this->r * $this->d2 * (0.5 - (1.0 + 3.0 * $this->t) * $this->d2 * $this->C3);
         $lam = $this->dd * (1.0 + $this->t * $this->d2 * (-$this->C4 + (1.0 + 3.0 * $this->t) * $this->d2 * $this->C5)) / cos($ph1);
     }
     $p->x = Common::adjust_lon($this->long0 + $lam);
     $p->y = $phi;
     return $p;
 }
예제 #2
0
파일: Sinu.php 프로젝트: rldhont/proj4php
 /**
  *
  * @param type $p
  * @return type 
  */
 public function inverse($p)
 {
     #$lat;
     #$temp;
     #$lon;
     /* Inverse equations
        ----------------- */
     $p->x -= $this->x0;
     $p->y -= $this->y0;
     $lat = $p->y / $this->a;
     if (isset($this->sphere)) {
         $p->y /= $this->C_y;
         $lat = $this->m ? asin(($this->m * $p->y + sin($p->y)) / $this->n) : ($this->n != 1.0 ? asin(sin($p->y) / $this->n) : $p->y);
         $lon = $p->x / ($this->C_x * ($this->m + cos($p->y)));
     } else {
         $lat = Common::pj_inv_mlfn($p->y / $this->a, $this->es, $this->en);
         $s = abs($lat);
         if ($s < Common::HALF_PI) {
             $s = sin($lat);
             $temp = $this->long0 + $p->x * sqrt(1.0 - $this->es * $s * $s) / ($this->a * cos($lat));
             //temp = $this->long0 + $p->x / ($this->a * cos($lat));
             $lon = Common::adjust_lon($temp);
         } else {
             if ($s - Common::EPSLN < Common::HALF_PI) {
                 $lon = $this->long0;
             }
         }
     }
     $p->x = $lon;
     $p->y = $lat;
     return $p;
 }