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


PHP Point::y方法代码示例

本文整理汇总了PHP中Point::y方法的典型用法代码示例。如果您正苦于以下问题:PHP Point::y方法的具体用法?PHP Point::y怎么用?PHP Point::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


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

示例1: push

 public function push(Point $point)
 {
     if (!isset($this->boundary[0]) || $this->boundary[0] > $point->x()) {
         $this->boundary[0] = $point->x();
     }
     if (!isset($this->boundary[1]) || $this->boundary[1] > $point->y()) {
         $this->boundary[1] = $point->y();
     }
     if (!isset($this->boundary[2]) || $this->boundary[2] < $point->x()) {
         $this->boundary[2] = $point->x();
     }
     if (!isset($this->boundary[3]) || $this->boundary[3] < $point->y()) {
         $this->boundary[3] = $point->y();
     }
     return $this;
 }
开发者ID:passbolt,项目名称:passbolt_selenium,代码行数:16,代码来源:boundary.php

示例2: encodePoint

 /**
  * @return string geohash
  * @param Point $point
  * @author algorithm based on code by Alexander Songe <a@songe.me>
  * @see https://github.com/asonge/php-geohash/issues/1
  */
 private function encodePoint($point, $precision = NULL)
 {
     if ($precision === NULL) {
         $lap = strlen($point->y()) - strpos($point->y(), ".");
         $lop = strlen($point->x()) - strpos($point->x(), ".");
         $precision = pow(10, -max($lap - 1, $lop - 1, 0)) / 2;
     }
     $minlat = -90;
     $maxlat = 90;
     $minlon = -180;
     $maxlon = 180;
     $latE = 90;
     $lonE = 180;
     $i = 0;
     $error = 180;
     $hash = '';
     while ($error >= $precision) {
         $chr = 0;
         for ($b = 4; $b >= 0; --$b) {
             if ((1 & $b) == (1 & $i)) {
                 // even char, even bit OR odd char, odd bit...a lon
                 $next = ($minlon + $maxlon) / 2;
                 if ($point->x() > $next) {
                     $chr |= pow(2, $b);
                     $minlon = $next;
                 } else {
                     $maxlon = $next;
                 }
                 $lonE /= 2;
             } else {
                 // odd char, even bit OR even char, odd bit...a lat
                 $next = ($minlat + $maxlat) / 2;
                 if ($point->y() > $next) {
                     $chr |= pow(2, $b);
                     $minlat = $next;
                 } else {
                     $maxlat = $next;
                 }
                 $latE /= 2;
             }
         }
         $hash .= $this->table[$chr];
         $i++;
         $error = min($latE, $lonE);
     }
     return $hash;
 }
开发者ID:fabianlipp,项目名称:ods_osm,代码行数:53,代码来源:GeoHash.class.php

示例3: fromVector

 /**
  * construct point from vector (pointing towards the point).
  */
 public static function fromVector(Vector $vector)
 {
     $point = new Point();
     $point->x($vector->x);
     $point->y($vector->y);
     $point->z($vector->z);
     return $point;
 }
开发者ID:eXcomm,项目名称:libvector3d,代码行数:11,代码来源:point.php

示例4: contains

 /**
  * Checks whether the given point/pixel is in- or outside 
  * of this outline based on the PointPolygonTest of OpenCV.
  *
  * @see docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=pointpolygontest#pointpolygontest
  *
  * @param Point   $point  the point/pixel to check.
  *
  * @return integer        whether the point/pixel is in- (1) or oudsite (2) or on the outline (0).
  * 
  */
 public function contains(Point $point)
 {
     $intersections = 0;
     $v2 = $this->outline[$this->size - 1];
     for ($i = 0; $i < $this->size; $i++) {
         $v1 = $v2;
         $v2 = $this->outline[$i];
         if ($v1->y() <= $point->y() && $v2->y() <= $point->y() || $v1->y() > $point->y() && $v2->y() > $point->y() || $v1->x() < $point->x() && $v2->x() < $point->x()) {
             if ($point->y() == $v2->y() && ($point->x() == $v2->x() || $point->y() == $v1->y() && ($v1->x() <= $point->x() && $point->x() <= $v2->x() || $v2->x() <= $point->x() && $point->x() <= $v1->x()))) {
                 return 0;
             }
             continue;
         }
         $dist = ($point->y() - $v1->y()) * ($v2->x() - $v1->x()) - ($point->x() - $v1->x()) * ($v2->y() - $v1->y());
         if ($dist == 0) {
             return 0;
         }
         if ($v2->y() < $v1->y()) {
             $dist = -$dist;
         }
         $intersections += $dist > 0;
     }
     // If the number of edges we passed through is odd, then it's in the polygon.
     return $intersections % 2 == 0 ? -1 : 1;
 }
开发者ID:passbolt,项目名称:passbolt_selenium,代码行数:36,代码来源:crawleroutline.php

示例5: cellAt

 public function cellAt(Point $point) : Cell
 {
     return $this->cells[$point->y()][$point->x()];
 }
开发者ID:theUniC,项目名称:minesweeper-kata,代码行数:4,代码来源:Grid.php

示例6: getWeatherAlert

 /**
  * Get set of weather alerts for the given Point
  *
  * <strong>Only Polish area</strong>
  * @param Point $point location coordinates
  * @return WeatherAlert set of weather alerts
  */
 public function getWeatherAlert(Point $point) : WeatherAlert
 {
     $dto = $this->client->ostrzezenia_pogodowe($point->y(), $point->x(), $this->apiKey);
     return (new WeatherAlert())->withAlert('frost', new Alert($dto->mroz, $dto->mroz_od_dnia, $dto->mroz_do_dnia))->withAlert('heat', new Alert($dto->upal, $dto->upal_od_dnia, $dto->upal_do_dnia))->withAlert('wind', new Alert($dto->wiatr, $dto->wiatr_od_dnia, $dto->wiatr_do_dnia))->withAlert('storm', new Alert($dto->burza, $dto->burza_od_dnia, $dto->burza_do_dnia))->withAlert('tornado', new Alert($dto->traba, $dto->traba_od_dnia, $dto->traba_do_dnia))->withAlert('precipitation', new Alert($dto->opad, $dto->opad_od_dnia, $dto->opad_do_dnia));
 }
开发者ID:krzysiekpiasecki,项目名称:BurzeDzisNet,代码行数:12,代码来源:BurzeDzisNet.php

示例7: equals

 /**
  * @param Point $point
  * @return boolean
  */
 public function equals(Point $point)
 {
     return $this->x() == $point->x() && $this->y() == $point->y();
 }
开发者ID:stefda,项目名称:pocketsail,代码行数:8,代码来源:Point.php

示例8: fromPoints

 public static function fromPoints(Point $point_a, Point $point_b)
 {
     $vector = new Vector();
     $vector->xyz($point_b->x() - $point_a->x(), $point_b->y() - $point_a->y(), $point_b->z() - $point_a->z());
     return $vector;
 }
开发者ID:eXcomm,项目名称:libvector3d,代码行数:6,代码来源:vector.php


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