public function forward($p) { $lon = $p->x; $lat = $p->y; /* Forward equations -----------------*/ $ml = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $lat); $rh1 = $this->a * ($this->g - $ml); $theta = $this->ns * Sourcemap_Proj::adjust_lon($lon - $this->long0); $x = $this->x0 + $rh1 * Math . sin($theta); $y = $this->y0 + $this->rh - $rh1 * cos($theta); $p->x = $x; $p->y = $y; return $p; }
/** Transverse Mercator Forward - long/lat to x/y long/lat in radians */ public function forward($p) { $lon = $p->x; $lat = $p->y; $delta_lon = Sourcemap_Proj::adjust_lon($lon - $this->long0); // Delta longitude # $con; // cone constant $sin_phi = sin($lat); $cos_phi = cos($lat); if ($this->sphere) { /* spherical form */ $b = $cos_phi * sin($delta_lon); if (abs(abs($b) - 1.0) < 1.0E-10) { throw new Exception("tmerc:forward: Point projects into infinity"); } else { $x = 0.5 * $this->a * $this->k0 * log((1.0 + $b) / (1.0 - $b)); $con = acos($cos_phi * cos($delta_lon) / sqrt(1.0 - $b * $b)); if ($lat < 0) { $con = -$con; } $y = $this->a * $this->k0 * ($con - $this->lat0); } } else { $al = $cos_phi * $delta_lon; $als = pow($al, 2); $c = $this->ep2 * pow($cos_phi, 2); $tq = tan($lat); $t = pow($tq, 2); $con = 1.0 - $this->es * pow($sin_phi, 2); $n = $this->a / sqrt($con); $ml = $this->a * Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $lat); $x = $this->k0 * $n * $al * (1.0 + $als / 6.0 * (1.0 - $t + $c + $als / 20.0 * (5.0 - 18.0 * $t + pow($t, 2) + 72.0 * $c - 58.0 * $this->ep2))) + $this->x0; $y = $this->k0 * ($ml - $this->ml0 + $n * $tq * ($als * (0.5 + $als / 24.0 * (5.0 - $t + 9.0 * $c + 4.0 * pow($c, 2) + $als / 30.0 * (61.0 - 58.0 * $t + pow($t, 2) + 600.0 * $c - 330.0 * $this->ep2))))) + $this->y0; } $p->x = $x; $p->y = $y; return $p; }
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 = Sourcemap_Proj::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 = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $lat); $ms = Sourcemap_Proj::msfnz($this->e, $sinphi, $cosphi); $con = $sinphi; $x = $this->x0 + $this->a * $ms * sin($con) / $sinphi; $y = $this->y0 + $this->a * ($ml - $this->ml0 + $ms * (1.0 - cos($con)) / $sinphi); } $p->x = $x; $p->y = $y; return $p; }