예제 #1
0
 public function inverse($pt)
 {
     $x = ($pt->x - $this->_proj->x0) / $this->_proj->k0;
     $y = $this->_proj->rh - ($pt->y - $this->_proj->y0) / $this->_proj->k0;
     if ($this->_proj->ns > 0) {
         $rh1 = sqrt($x * $x + $y * $y);
         $con = 1.0;
     } else {
         $rh1 = -sqrt(x * x + y * y);
         $con = -1.0;
     }
     $theta = 0.0;
     if ($rh1 != 0) {
         $theta = atan2($con * $x, $con * $y);
     }
     if ($rh1 != 0 || $this->_proj->ns > 0.0) {
         $con = 1.0 / $this->_proj->ns;
         $ts = pow($rh1 / ($this->_proj->a * $this->_proj->f0), $con);
         $lat = Sourcemap_Proj::phi2z($this->_proj->e, $ts);
         if ($lat == -9999) {
             return null;
         }
     } else {
         $lat = -Sourcemap_Proj::HALF_PI;
     }
     $lon = Sourcemap_Proj::adjust_lon($theta / $this->_proj->ns + $this->_proj->long0);
     $pt->x = $lon;
     $pt->y = $lat;
     return $pt;
 }
예제 #2
0
 public function inverse($p)
 {
     #        $delta_lon;	/* Delta longitude (Given longitude - center 	*/
     #        $theta;		/* angle					*/
     #        $delta_theta;	/* adjusted longitude				*/
     #        $sin_phi, $cos_phi;/* sin and cos value				*/
     #        $b;		/* temporary values				*/
     #        $c, $t, $tq;	/* temporary values				*/
     #        $con, $n, $ml;	/* cone constant, small m			*/
     #        $vs, $us, $q, $s, $ts1;
     #        $vl, $ul, $bs;
     #        $dlon;
     #        $flag;
     /* Inverse equations
        -----------------*/
     $p->x -= $this->x0;
     $p->y -= $this->y0;
     $flag = 0;
     $vs = $p->x * $this->cosaz - $p->y * $this->sinaz;
     $us = $p->y * $this->cosaz + $p->x * $this->sinaz;
     $us = $us + $this->u;
     $q = exp(-$this->bl * $vs / $this->al);
     $s = 0.5 * ($q - 1.0 / $q);
     $t = 0.5 * ($q + 1.0 / $q);
     $vl = sin($this->bl * $us / $this->al);
     $ul = ($vl * $this->cosgam + $s * $this->singam) / $t;
     if (abs(abs($ul) - 1.0) <= Sourcemap_Proj::EPSLN) {
         $lon = $this->longc;
         if ($ul >= 0.0) {
             $lat = Sourcemap_Proj::HALF_PI;
         } else {
             $lat = -Sourcemap_Proj::HALF_PI;
         }
     } else {
         $con = 1.0 / $this->bl;
         $ts1 = pow($this->el / sqrt((1.0 + $ul) / (1.0 - $ul)), $con);
         $lat = Sourcemap_Proj::phi2z($this->e, $ts1);
         //if (flag != 0)
         //return(flag);
         //~ con = cos($this->bl * us /al);
         $theta = $this->longc - atan2($s * $this->cosgam - $vl * $this->singam, $con) / $this->bl;
         $lon = Sourcemap_Proj::adjust_lon($theta);
     }
     $p->x = $lon;
     $p->y = $lat;
     return $p;
 }
예제 #3
0
 public function inverse($pt)
 {
     $x = $pt->x - $this->_proj->x0;
     $y = $pt->y - $this->_proj->y0;
     if ($this->_proj->sphere) {
         $lat = Sourcemap_Proj::HALF_PI - 2.0 * atan(exp(-$y / $this->_proj->a * $this->_proj->k0));
     } else {
         $ts = exp(-$y / ($this->_proj->a * $this->_proj->k0));
         $lat = Sourcemap_Proj::phi2z($this->_proj->e, $ts);
         if ($lat == -9999) {
             throw new Exception("Lat = -9999");
         }
     }
     $lon = Sourcemap_Proj::adjust_lon($this->_proj->long0 + $x / ($this->_proj->a * $this->_proj->k0));
     $pt->x = $lon;
     $pt->y = $lat;
     return $pt;
 }