/** * @param type $p * @return null */ public function inverse($p) { $DEL_TOL = 1.0E-14; $lon = $p->x / $this->C; $lat = $p->y; $num = pow(tan(0.5 * $lat + Common::FORTPI) / $this->K, 1.0 / $this->C); for ($i = Common::MAX_ITER; $i > 0; --$i) { $lat = 2.0 * atan($num * Common::srat($this->e * sin($p->y), -0.5 * $this->e)) - Common::HALF_PI; if (abs($lat - $p->y) < $DEL_TOL) { break; } $p->y = $lat; } // convergence failed if (!$i) { Proj4php::reportError("gauss:inverse:convergence failed"); return null; } $p->x = $lon; $p->y = $lat; return $p; }