public function testMsfnz() { $ret = Common::msfnz(0.12, 0.3, 0.4); $this->assertEquals(0.40025945221481, $ret, "", 1.0E-6); $ret = Common::msfnz(0.2, 0.23, 0.1); $this->assertEquals(0.10010596820122, $ret, "", 1.0E-6); }
/** * @return void */ public function init() { if (abs($this->lat1 + $this->lat2) < Common::EPSLN) { Proj4php::reportError("aeaInitEqualLatitudes"); return; } $this->temp = $this->b / $this->a; $this->es = 1.0 - pow($this->temp, 2); $this->e3 = sqrt($this->es); $this->sin_po = sin($this->lat1); $this->cos_po = cos($this->lat1); $this->t1 = $this->sin_po; $this->con = $this->sin_po; $this->ms1 = Common::msfnz($this->e3, $this->sin_po, $this->cos_po); $this->qs1 = Common::qsfnz($this->e3, $this->sin_po, $this->cos_po); $this->sin_po = sin($this->lat2); $this->cos_po = cos($this->lat2); $this->t2 = $this->sin_po; $this->ms2 = Common::msfnz($this->e3, $this->sin_po, $this->cos_po); $this->qs2 = Common::qsfnz($this->e3, $this->sin_po, $this->cos_po); $this->sin_po = sin($this->lat0); $this->cos_po = cos($this->lat0); $this->t3 = $this->sin_po; $this->qs0 = Common::qsfnz($this->e3, $this->sin_po, $this->cos_po); if (abs($this->lat1 - $this->lat2) > Common::EPSLN) { $this->ns0 = ($this->ms1 * $this->ms1 - $this->ms2 * $this->ms2) / ($this->qs2 - $this->qs1); } else { $this->ns0 = $this->con; } $this->c = $this->ms1 * $this->ms1 + $this->ns0 * $this->qs1; $this->rh = $this->a * sqrt($this->c - $this->ns0 * $this->qs0) / $this->ns0; }
public function init() { //?$this->temp = $this->r_minor / $this->r_major; //$this->temp = $this->b / $this->a; //$this->es = 1.0 - sqrt($this->temp); //$this->e = sqrt( $this->es ); //?$this->m1 = cos($this->lat_origin) / (sqrt( 1.0 - $this->es * sin($this->lat_origin) * sin($this->lat_origin))); //$this->m1 = cos(0.0) / (sqrt( 1.0 - $this->es * sin(0.0) * sin(0.0))); if ($this->lat_ts) { if ($this->sphere) { $this->k0 = cos($this->lat_ts); } else { $this->k0 = Common::msfnz($this->es, sin($this->lat_ts), cos($this->lat_ts)); } } }
public function init() { /* Place parameters in static storage for common use ------------------------------------------------- */ if (!$this->mode) { $this->mode = 0; } //chosen default mode $this->temp = $this->b / $this->a; $this->es = 1.0 - pow($this->temp, 2); $this->e = sqrt($this->es); $this->e0 = Common::e0fn($this->es); $this->e1 = Common::e1fn($this->es); $this->e2 = Common::e2fn($this->es); $this->e3 = Common::e3fn($this->es); $this->sinphi = sin($this->lat1); $this->cosphi = cos($this->lat1); $this->ms1 = Common::msfnz($this->e, $this->sinphi, $this->cosphi); $this->ml1 = Common::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat1); /* format B --------- */ if ($this->mode != 0) { if (abs($this->lat1 + $this->lat2) < Common::EPSLN) { Proj4php::reportError("eqdc:Init:EqualLatitudes"); //return(81); } $this->sinphi = sin($this->lat2); $this->cosphi = cos($this->lat2); $this->ms2 = Common::msfnz($this->e, $this->sinphi, $this->cosphi); $this->ml2 = Common::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat2); if (abs($this->lat1 - $this->lat2) >= Common::EPSLN) { $this->ns = ($this->ms1 - $this->ms2) / ($this->ml2 - $this->ml1); } else { $this->ns = $this->sinphi; } } else { $this->ns = $this->sinphi; } $this->g = $this->ml1 + $this->ms1 / $this->ns; $this->ml0 = Common::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat0); $this->rh = $this->a * ($this->g - $this->ml0); }
public function init() { //?$this->temp = $this->r_minor / $this->r_major; //$this->temp = $this->b / $this->a; //$this->es = 1.0 - sqrt($this->temp); //$this->e = sqrt( $this->es ); //?$this->m1 = cos($this->lat_origin) / (sqrt( 1.0 - $this->es * sin($this->lat_origin) * sin($this->lat_origin))); //$this->m1 = cos(0.0) / (sqrt( 1.0 - $this->es * sin(0.0) * sin(0.0))); if (!isset($this->lat_ts)) { //SR-ORG:16 proj4 does not declare lat_ts; $this->lat_ts = 0; } if ($this->lat_ts) { if (isset($this->sphere)) { //EPSG:3752 does not define sphere $this->k0 = cos($this->lat_ts); } else { $this->k0 = Common::msfnz($this->es, sin($this->lat_ts), cos($this->lat_ts)); } } }
public function init() { // array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north //double c_lat; /* center latitude */ //double c_lon; /* center longitude */ //double lat1; /* first standard parallel */ //double lat2; /* second standard parallel */ //double r_maj; /* major axis */ //double r_min; /* minor axis */ //double false_east; /* x offset in meters */ //double false_north; /* y offset in meters */ // If lat2 is not defined if (!isset($this->lat2)) { $this->lat2 = $this->lat0; } if (!isset($this->k0)) { $this->k0 = 1.0; } // Standard Parallels cannot be equal and on opposite sides of the equator if (abs($this->lat1 + $this->lat2) < Common::EPSLN) { Proj4php::reportError("lcc:init: Equal Latitudes"); return; } $temp = $this->b / $this->a; $this->e = sqrt(1.0 - $temp * $temp); $sin1 = sin($this->lat1); $cos1 = cos($this->lat1); $ms1 = Common::msfnz($this->e, $sin1, $cos1); $ts1 = Common::tsfnz($this->e, $this->lat1, $sin1); $sin2 = sin($this->lat2); $cos2 = cos($this->lat2); $ms2 = Common::msfnz($this->e, $sin2, $cos2); $ts2 = Common::tsfnz($this->e, $this->lat2, $sin2); $ts0 = Common::tsfnz($this->e, $this->lat0, sin($this->lat0)); if (abs($this->lat1 - $this->lat2) > Common::EPSLN) { $this->ns = log($ms1 / $ms2) / log($ts1 / $ts2); } else { $this->ns = $sin1; } $this->f0 = $ms1 / ($this->ns * pow($ts1, $this->ns)); $this->rh = $this->a * $this->f0 * pow($ts0, $this->ns); if (!isset($this->title)) { $this->title = 'Lambert Conformal Conic'; } }
public function debugString() { $str = "title= {$this->title}\n"; $str .= "k0={$this->k0}\n"; $str .= "to_meter={$this->to_meter}\n"; $str .= "phiF = {$this->lat0}\n"; $str .= "lamF = {$this->long0}\n"; $str .= "phi1 = {$this->lat1}\n"; $str .= "phi2 = {$this->lat2}\n"; $str .= "EF = {$this->x0}\n"; $str .= "NF = {$this->y0}\n"; $str .= "a={$this->a}\n"; $str .= "e={$this->e}\n"; $str .= "m1=" . Common::msfnz($this->e, sin($this->lat1), cos($this->lat1)) . "\n"; $str .= "m2=" . Common::msfnz($this->e, sin($this->lat2), cos($this->lat2)) . "\n"; $str .= "n={$this->ns}\n"; $str .= "F={$this->f0}\n"; $str .= "tF=" . Common::tsfnz($this->e, $this->lat0, sin($this->lat0)) . "\n"; $str .= "t1=" . Common::tsfnz($this->e, $this->lat1, sin($this->lat1)) . "\n"; $str .= "t2=" . Common::tsfnz($this->e, $this->lat2, sin($this->lat2)) . "\n"; $str .= "rF={$this->rh}\n"; return $str; }
public function forward($p) { /* $sinphi; $cosphi; // sin and cos value $al; // temporary values $c; // temporary values $con; $ml; // cone constant, small m $ms; // small m $x; $y; */ $lon = $p->x; $lat = $p->y; $con = Common::adjust_lon($lon - $this->long0); if (abs($lat) <= 1.0E-7) { $x = $this->x0 + $this->a * $con; $y = $this->y0 - $this->a * $this->ml0; } else { $sinphi = sin($lat); $cosphi = cos($lat); $ml = Common::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $lat); $ms = Common::msfnz($this->e, $sinphi, $cosphi); $x = $this->x0 + $this->a * $ms * sin($sinphi) / $sinphi; $y = $this->y0 + $this->a * ($ml - $this->ml0 + $ms * (1.0 - cos($sinphi)) / $sinphi); } $p->x = $x; $p->y = $y; return $p; }