當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vector3::getIntermediateWithYValue方法代碼示例

本文整理匯總了PHP中pocketmine\math\Vector3::getIntermediateWithYValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vector3::getIntermediateWithYValue方法的具體用法?PHP Vector3::getIntermediateWithYValue怎麽用?PHP Vector3::getIntermediateWithYValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\math\Vector3的用法示例。


在下文中一共展示了Vector3::getIntermediateWithYValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: calculateIntercept

 /**
  * @param Vector3 $pos1
  * @param Vector3 $pos2
  *
  * @return MovingObjectPosition
  */
 public function calculateIntercept(Vector3 $pos1, Vector3 $pos2)
 {
     $bb = $this->getBoundingBox();
     if ($bb === null) {
         return null;
     }
     $v1 = $pos1->getIntermediateWithXValue($pos2, $bb->minX);
     $v2 = $pos1->getIntermediateWithXValue($pos2, $bb->maxX);
     $v3 = $pos1->getIntermediateWithYValue($pos2, $bb->minY);
     $v4 = $pos1->getIntermediateWithYValue($pos2, $bb->maxY);
     $v5 = $pos1->getIntermediateWithZValue($pos2, $bb->minZ);
     $v6 = $pos1->getIntermediateWithZValue($pos2, $bb->maxZ);
     if ($v1 !== null and !$bb->isVectorInYZ($v1)) {
         $v1 = null;
     }
     if ($v2 !== null and !$bb->isVectorInYZ($v2)) {
         $v2 = null;
     }
     if ($v3 !== null and !$bb->isVectorInXZ($v3)) {
         $v3 = null;
     }
     if ($v4 !== null and !$bb->isVectorInXZ($v4)) {
         $v4 = null;
     }
     if ($v5 !== null and !$bb->isVectorInXY($v5)) {
         $v5 = null;
     }
     if ($v6 !== null and !$bb->isVectorInXY($v6)) {
         $v6 = null;
     }
     $vector = $v1;
     if ($v2 !== null and ($vector === null or $pos1->distanceSquared($v2) < $pos1->distanceSquared($vector))) {
         $vector = $v2;
     }
     if ($v3 !== null and ($vector === null or $pos1->distanceSquared($v3) < $pos1->distanceSquared($vector))) {
         $vector = $v3;
     }
     if ($v4 !== null and ($vector === null or $pos1->distanceSquared($v4) < $pos1->distanceSquared($vector))) {
         $vector = $v4;
     }
     if ($v5 !== null and ($vector === null or $pos1->distanceSquared($v5) < $pos1->distanceSquared($vector))) {
         $vector = $v5;
     }
     if ($v6 !== null and ($vector === null or $pos1->distanceSquared($v6) < $pos1->distanceSquared($vector))) {
         $vector = $v6;
     }
     if ($vector === null) {
         return null;
     }
     $f = -1;
     if ($vector === $v1) {
         $f = 4;
     } elseif ($vector === $v2) {
         $f = 5;
     } elseif ($vector === $v3) {
         $f = 0;
     } elseif ($vector === $v4) {
         $f = 1;
     } elseif ($vector === $v5) {
         $f = 2;
     } elseif ($vector === $v6) {
         $f = 3;
     }
     return MovingObjectPosition::fromBlock($this->x, $this->y, $this->z, $f, $vector->add($this->x, $this->y, $this->z));
 }
開發者ID:1455931078,項目名稱:Genisys,代碼行數:71,代碼來源:Block.php

示例2: getIntermediateVectorsArray

 /**
  *
  * Returns 6 intermediate vectors by positions
  *
  * @param Vector3 $pos1
  * @param Vector3 $pos2
  * @return Vector3[]
  */
 public function getIntermediateVectorsArray(Vector3 $pos1, Vector3 $pos2)
 {
     return ['v1' => $pos1->getIntermediateWithXValue($pos2, $this->minX), 'v2' => $pos1->getIntermediateWithXValue($pos2, $this->maxX), 'v3' => $pos1->getIntermediateWithYValue($pos2, $this->minY), 'v4' => $pos1->getIntermediateWithYValue($pos2, $this->maxY), 'v5' => $pos1->getIntermediateWithZValue($pos2, $this->minZ), 'v6' => $pos1->getIntermediateWithZValue($pos2, $this->maxZ)];
 }
開發者ID:Guillaume351,項目名稱:Katana,代碼行數:12,代碼來源:AxisAlignedBB.php


注:本文中的pocketmine\math\Vector3::getIntermediateWithYValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。