当前位置: 首页>>代码示例>>PHP>>正文


PHP tan函数代码示例

本文整理汇总了PHP中tan函数的典型用法代码示例。如果您正苦于以下问题:PHP tan函数的具体用法?PHP tan怎么用?PHP tan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了tan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forward

 public function forward($p)
 {
     //alert("ll2m coords : ".coords);
     $lon = $p->x;
     $lat = $p->y;
     // convert to radians
     if ($lat * Proj4php::$common->R2D > 90.0 && $lat * Proj4php::$common->R2D < -90.0 && $lon * Proj4php::$common->R2D > 180.0 && $lon * Proj4php::$common->R2D < -180.0) {
         Proj4php::reportError("merc:forward: llInputOutOfRange: " . $lon . " : " . $lat);
         return null;
     }
     if (abs(abs($lat) - Proj4php::$common->HALF_PI) <= Proj4php::$common->EPSLN) {
         Proj4php::reportError("merc:forward: ll2mAtPoles");
         return null;
     } else {
         if ($this->sphere) {
             $x = $this->x0 + $this->a * $this->k0 * Proj4php::$common->adjust_lon($lon - $this->long0);
             $y = $this->y0 + $this->a * $this->k0 * log(tan(Proj4php::$common->FORTPI + 0.5 * $lat));
         } else {
             $sinphi = sin(lat);
             $ts = Proj4php::$common->tsfnz($this->e, $lat, $sinphi);
             $x = $this->x0 + $this->a * $this->k0 * Proj4php::$common->adjust_lon($lon - $this->long0);
             $y = $this->y0 - $this->a * $this->k0 * log($ts);
         }
         $p->x = $x;
         $p->y = $y;
         return $p;
     }
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:28,代码来源:merc.php

示例2: inverse

 public function inverse($p)
 {
     $Y = $p->x - $this->x0;
     $X = $p->y - $this->y0;
     $rotI = $Y / $this->R;
     $rotB = 2 * (atan(exp(X / $this->R)) - Sourcemap_Proj::PI / 4.0);
     $b = asin(cos($this->b0) * sin($rotB) + sin($this->b0) * cos($rotB) * cos($rotI));
     $I = atan(sin($rotI) / (cos($this->b0) * cos($rotI) - sin($this->b0) * tan($rotB)));
     $lambda = $this->lambda0 + $I / $this->alpha;
     $S = 0.0;
     $phy = $b;
     $prevPhy = -1000.0;
     $iteration = 0;
     while (abs($phy - $prevPhy) > 1.0E-7) {
         if (++$iteration > 20) {
             throw new Exception("Infinity...");
         }
         //S = log(tan(Sourcemap_Proj::PI / 4.0 + $phy / 2.0));
         $S = 1.0 / $this->alpha * (log(tan(Sourcemap_Proj::PI / 4.0 + $b / 2.0)) - $this->K) + $this->e * log(tan(Sourcemap_Proj::PI / 4.0 + asin($this->e * sin($phy)) / 2.0));
         $prevPhy = $phy;
         $phy = 2.0 * atan(exp($S)) - Sourcemap_Proj::PI / 2.0;
     }
     $p->x = $lambda;
     $p->y = $phy;
     return $p;
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:26,代码来源:somerc.php

示例3: geoToPixel

function geoToPixel($lat, $lon, $zoomLevel)
{
    $mapSize = TILE_SIZE << $zoomLevel;
    $latitude = min(1, max(0, 0.5 - log(tan(M_PI / 4 + M_PI / 2 * $lat / 180)) / M_PI / 2));
    $longitude = $lon / 360 + 0.5;
    return array("x" => intval($longitude * $mapSize), "y" => intval($latitude * $mapSize));
}
开发者ID:netconstructor,项目名称:osmbuildings,代码行数:7,代码来源:index.php

示例4: ex3

 public static function ex3()
 {
     header('Content-type: application/json');
     if (is_numeric($_POST['x'])) {
         $x = $_POST['x'];
         $p = $_POST['p'];
         if (is_numeric($p)) {
             $e = pow(10, -$p);
             if ($x > -M_PI && $x < M_PI) {
                 $aprox = self::LentzAlgorithm($x, $e);
                 $tan = tan($x);
                 echo json_encode(array('aprox' => $aprox, 'tan' => $tan, 'pi' => M_PI, 'e' => $e, 'x' => $x));
                 exit;
             } elseif ($x < -M_PI || $x > M_PI) {
                 if ($x < 0) {
                     (double) ($real_x = fmod($x, -M_PI / 2));
                 } else {
                     (double) ($real_x = fmod($x, M_PI / 2));
                 }
                 $aprox = -self::LentzAlgorithm($real_x, $e);
                 $tan = tan($x);
                 echo json_encode(array('aprox' => $aprox, 'tan' => $tan, 'pi' => M_PI, 'e' => $e, 'x' => $x));
                 exit;
             } else {
                 //$aprox=self::LentzAlgorithm($x,$e);
                 //$tan=tan($x);
                 echo json_encode(array('aprox' => 0, 'tan' => 0, 'pi' => 0, 'e' => 0, 'x' => 0));
                 exit;
             }
         }
         //if
     }
     //if
 }
开发者ID:hoenirvili,项目名称:cn,代码行数:34,代码来源:HomeWork1.php

示例5: perspective

function perspective($fovy, $aspect, $zNear, $zFar)
{
    $fovy = deg2rad($fovy);
    $f = 1 / tan($fovy / 2);
    $result = new mat4([[$f / $aspect, 0, 0, 0], [0, $f, 0, 0], [0, 0, ($zFar + $zNear) / ($zNear - $zFar), -1], [0, 0, -2 * $zFar * $zNear / ($zFar - $zNear), 0]]);
    return $result;
}
开发者ID:ponup,项目名称:glm,代码行数:7,代码来源:globals.php

示例6: toLatLng

 /**
  * Convert this UTM reference to a latitude and longitude
  *
  * @return the converted latitude and longitude
  */
 function toLatLng()
 {
     $wgs84 = new ReferenceEllipsoid(ReferenceEllipsoid::WGS84_MAJ, ReferenceEllipsoid::WGS84_MIN);
     $UTM_F0 = 0.9996;
     $a = $wgs84->maj;
     $eSquared = $wgs84->ecc;
     $ePrimeSquared = $eSquared / (1.0 - $eSquared);
     $e1 = (1 - sqrt(1 - $eSquared)) / (1 + sqrt(1 - $eSquared));
     $x = $this->easting - 500000.0;
     $y = $this->northing;
     $zoneNumber = $this->lngZone;
     $zoneLetter = $this->latZone;
     $longitudeOrigin = ($zoneNumber - 1.0) * 6.0 - 180.0 + 3.0;
     // Correct y for southern hemisphere
     if (ord($zoneLetter) - ord("N") < 0) {
         $y -= 10000000.0;
     }
     $m = $y / $UTM_F0;
     $mu = $m / ($a * (1.0 - $eSquared / 4.0 - 3.0 * $eSquared * $eSquared / 64.0 - 5.0 * pow($eSquared, 3.0) / 256.0));
     $phi1Rad = $mu + (3.0 * $e1 / 2.0 - 27.0 * pow($e1, 3.0) / 32.0) * sin(2.0 * $mu) + (21.0 * $e1 * $e1 / 16.0 - 55.0 * pow($e1, 4.0) / 32.0) * sin(4.0 * $mu) + 151.0 * pow($e1, 3.0) / 96.0 * sin(6.0 * $mu);
     $n = $a / sqrt(1.0 - $eSquared * sin($phi1Rad) * sin($phi1Rad));
     $t = tan($phi1Rad) * tan($phi1Rad);
     $c = $ePrimeSquared * cos($phi1Rad) * cos($phi1Rad);
     $r = $a * (1.0 - $eSquared) / pow(1.0 - $eSquared * sin($phi1Rad) * sin($phi1Rad), 1.5);
     $d = $x / ($n * $UTM_F0);
     $latitude = ($phi1Rad - $n * tan($phi1Rad) / $r * ($d * $d / 2.0 - (5.0 + 3.0 * $t + 10.0 * $c - 4.0 * $c * $c - 9.0 * $ePrimeSquared) * pow($d, 4.0) / 24.0 + (61.0 + 90.0 * $t + 298.0 * $c + 45.0 * $t * $t - 252.0 * $ePrimeSquared - 3.0 * $c * $c) * pow($d, 6.0) / 720.0)) * (180.0 / pi());
     $longitude = $longitudeOrigin + ($d - (1.0 + 2.0 * $t + $c) * pow($d, 3.0) / 6.0 + (5.0 - 2.0 * $c + 28.0 * $t - 3.0 * $c * $c + 8.0 * $ePrimeSquared + 24.0 * $t * $t) * pow($d, 5.0) / 120.0) / cos($phi1Rad) * (180.0 / pi());
     return new LatLng($latitude, $longitude);
 }
开发者ID:nevstokes,项目名称:coords,代码行数:34,代码来源:UTMRef.php

示例7: LatLonToMeters

 public function LatLonToMeters($lat, $lon)
 {
     $mx = $lon * $this->originShift / 180.0;
     $my = log(tan((90 + $lat) * pi() / 360.0)) / (pi() / 180.0);
     $my = $my * $this->originShift / 180.0;
     return array($mx, $my);
 }
开发者ID:netconstructor,项目名称:cartodb-staticmap-php,代码行数:7,代码来源:class.cartodb-staticmap.php

示例8: forward

 public function forward($pt)
 {
     $lon = $pt->x;
     $lat = $pt->y;
     // convert to radians
     if ($lat * Sourcemap_Proj::R2D > 90.0 && $lat * Sourcemap_Proj::R2D < -90.0 && $lon * Sourcemap_Proj::R2D > 180.0 && $lon * Sourcemap_Proj::R2D < -180.0) {
         throw new Exception('Lat/Lon input out of range.');
     }
     if (abs(abs($lat) - Sourcemap_Proj::HALF_PI) <= Sourcemap_Proj::EPSLN) {
         throw new Exception('Lat/Long at poles.');
     } else {
         if ($this->_proj->sphere) {
             $x = $this->_proj->x0 + $this->_proj->a * $this->_proj->k0 * Sourcemap_Proj::adjust_lon($lon - $this->_proj->long0);
             $y = $this->_proj->y0 + $this->_proj->a * $this->_proj->k0 * log(tan(Sourcemap_Proj::FORTPI + 0.5 * $lat));
         } else {
             $sinphi = sin($lat);
             $ts = Sourcemap_Proj::tsfnz($this->_proj->e, $lat, $sinphi);
             $x = $this->_proj->x0 + $this->_proj->a * $this->_proj->k0 * Sourcemap_Proj::adjust_lon($lon - $this->_proj->long0);
             $y = $this->_proj->y0 - $this->_proj->a * $this->_proj->k0 * log($ts);
         }
         $pt->x = $x;
         $pt->y = $y;
         return $pt;
     }
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:25,代码来源:merc.php

示例9: latLonToMeters

 static function latLonToMeters($lat, $lng)
 {
     $mx = $lng * self::originShift() / 180;
     $my = log(tan((90 + $lat) * pi() / 360.0)) / (pi() / 180);
     $my = $my * self::originShift() / 180;
     return new GoogleMapPoint($mx, $my);
 }
开发者ID:markguinn,项目名称:silverstripe-gis,代码行数:7,代码来源:GoogleMapUtility.php

示例10: phi4z

 public function phi4z($eccent, $e0, $e1, $e2, $e3, $a, $b, $c, $phi)
 {
     $phi = $a;
     for ($i = 1; $i <= 15; $i++) {
         $sinphi = sin($phi);
         $tanphi = tan($phi);
         $c = $tanphi * sqrt(1.0 - $eccent * $sinphi * $sinphi);
         $sin2ph = sin(2.0 * $phi);
         /*
           ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 *  *phi);
           mlp = e0 - 2.0 * e1 * cos (2.0 *  *phi) + 4.0 * e2 *  cos (4.0 *  *phi);
         */
         $ml = $e0 * $phi - $e1 * $sin2ph + $e2 * sin(4.0 * $phi) - $e3 * sin(6.0 * $phi);
         $mlp = $e0 - 2.0 * $e1 * cos(2.0 * $phi) + 4.0 * $e2 * cos(4.0 * $phi) - 6.0 * $e3 * cos(6.0 * $phi);
         $con1 = 2.0 * $ml + $c * ($ml * $ml + $b) - 2.0 * $a * ($c * $ml + 1.0);
         $con2 = $eccent * $sin2ph * ($ml * $ml + $b - 2.0 * $a * $ml) / (2.0 * $c);
         $con3 = 2.0 * ($a - $ml) * ($c * $mlp - 2.0 / $sin2ph) - 2.0 * $mlp;
         $dphi = $con1 / ($con2 + $con3);
         $phi += $dphi;
         if (abs($dphi) <= 1.0E-10) {
             return $phi;
         }
     }
     throw new Exception("phi4z: No convergence");
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:25,代码来源:poly.php

示例11: draw

 /**
  * @return RandomLinesBackgroundDrawer
  **/
 public function draw()
 {
     $imageId = $this->getTuringImage()->getImageId();
     $height = $this->getTuringImage()->getHeight();
     $width = $this->getTuringImage()->getWidth();
     for ($i = 0; $i < $this->count; ++$i) {
         $color = $this->makeColor();
         $colorId = $this->getTuringImage()->getColorIdentifier($color);
         $y = mt_rand(1, $height - 1);
         $x = mt_rand(1, $width - 1);
         $angle = mt_rand(0, 180);
         while ($angle == 90) {
             $angle = mt_rand(0, 180);
         }
         $angleRad = deg2rad($angle);
         $dy = ($width - $x) * tan($angleRad);
         if ($dy < $y) {
             $xEnd = $width;
             $yEnd = $y - $dy;
         } else {
             $yEnd = 0;
             $xEnd = $x + tan($angleRad) / $y;
         }
         $dy = $x * tan($angleRad);
         if ($dy <= $height - $y) {
             $xStart = 0;
             $yStart = $y + $dy;
         } else {
             $yStart = $height;
             $xStart = $x - tan($angleRad) / ($height - $y);
         }
         imageline($imageId, $xStart, $yStart, $xEnd, $yEnd, $colorId);
     }
     return $this;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:38,代码来源:RandomLinesBackgroundDrawer.class.php

示例12: createFromWidthAndAlpha

 public function createFromWidthAndAlpha(array $coords)
 {
     $width = $coords[0];
     $alpha = $coords[1];
     $height = tan(deg2rad($alpha)) * $width;
     return $this->createFromCoordinates(array(0, 0, $width, $height));
 }
开发者ID:atelierspierrot,项目名称:maths,代码行数:7,代码来源:TriangleRectangle.php

示例13: intersects

 /**
  * Computes whether the vertical segment (lat3, lng3) to South Pole intersects the segment
  * (lat1, lng1) to (lat2, lng2).
  * Longitudes are offset by -lng1; the implicit lng1 becomes 0.
  */
 private static function intersects($lat1, $lat2, $lng2, $lat3, $lng3, $geodesic)
 {
     // Both ends on the same side of lng3.
     if ($lng3 >= 0 && $lng3 >= $lng2 || $lng3 < 0 && $lng3 < $lng2) {
         return false;
     }
     // Point is South Pole.
     if ($lat3 <= -M_PI / 2) {
         return false;
     }
     // Any segment end is a pole.
     if ($lat1 <= -M_PI / 2 || $lat2 <= -M_PI / 2 || $lat1 >= M_PI / 2 || $lat2 >= M_PI / 2) {
         return false;
     }
     if ($lng2 <= -M_PI) {
         return false;
     }
     $linearLat = ($lat1 * ($lng2 - $lng3) + $lat2 * $lng3) / $lng2;
     // Northern hemisphere and point under lat-lng line.
     if ($lat1 >= 0 && $lat2 >= 0 && $lat3 < $linearLat) {
         return false;
     }
     // Southern hemisphere and point above lat-lng line.
     if ($lat1 <= 0 && $lat2 <= 0 && $lat3 >= $linearLat) {
         return true;
     }
     // North Pole.
     if ($lat3 >= M_PI / 2) {
         return true;
     }
     // Compare lat3 with latitude on the GC/Rhumb segment corresponding to lng3.
     // Compare through a strictly-increasing function (tan() or mercator()) as convenient.
     return $geodesic ? tan($lat3) >= self::tanLatGC($lat1, $lat2, $lng2, $lng3) : MathUtil::mercator($lat3) >= self::mercatorLatRhumb($lat1, $lat2, $lng2, $lng3);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:39,代码来源:PolyUtil.php

示例14: solphy

function solphy($dj, &$lo, &$bo, &$p)
{
    global $T2000, $DGRAD, $DPI;
    $t = ($dj - $T2000) / 3652500;
    $t2 = $t * $t;
    $t3 = pow($t, 3);
    $t4 = pow($t, 4);
    $t5 = pow($t, 5);
    $gi = 7.25 * $DGRAD;
    $go = 73 + 40.0 / 60.0 + 50.25 / 3600 * ($dj - 2396758.5) / 365.25;
    $gm = 112.766 + (2430000.5 - $dj) * 14.18439716 + 180;
    $go = fmod($go * $DGRAD, $DPI);
    $gm = fmod($gm * $DGRAD, $DPI);
    $a1 = 2.18 - 3375.7 * $t + 0.36 * $t2;
    $a2 = 3.51 + 125666.39 * $t + 0.1 * $t2;
    $dpsi = 1.0E-7 * (-834 * sin($a1) - 64 * sin($a2));
    $epsv = 0.4090928 + 1.0E-7 * (-226938 * $t - 75 * $t2 + 96926 * $t3 - 2491 * $t4 - 12104 * $t5 + 446 * cos($a1) + 28 * cos($a2));
    $gla = lonsol($dj);
    $gl = $gla - $dpsi;
    $c = cos($gl - $go);
    $s = sin($gl - $go);
    //print "a1: $a1 a2: $a2 dpsi: $dpsi gla: $gla gl: $gl c: $c s: $s<BR>";
    $lo = atan2(-$s * cos($gi), -$c) + $gm;
    $lo = fmod($lo, $DPI);
    if ($lo < 0) {
        $lo += $DPI;
    }
    $bo = asin($s * sin($gi));
    $x = atan(-cos($gla) * tan($epsv));
    $y = atan(-$c * tan($gi));
    $p = $x + $y;
}
开发者ID:helio-vo,项目名称:helio,代码行数:32,代码来源:paramsol.php

示例15: getmercator

function getmercator($sx, $sy, $ex, $ey)
{
    $sx = $sx * 6371000.0 * M_PI / 180;
    $sy = log(tan(M_PI_4 + $sy * M_PI / 360)) * 6371000.0;
    $ex = $ex * 6371000.0 * M_PI / 180;
    $ey = log(tan(M_PI_4 + $ey * M_PI / 360)) * 6371000.0;
    return array('l' => array('x' => $sx, 'y' => $sy), 'h' => array('x' => $ex, 'y' => $ey));
}
开发者ID:zoff99,项目名称:navit,代码行数:8,代码来源:mapextract.php


注:本文中的tan函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。