|
| | __construct ($x=0, $y=0, $z=0) |
| |
| | getX () |
| |
| | getY () |
| |
| | getZ () |
| |
| | getFloorX () |
| |
| | getFloorY () |
| |
| | getFloorZ () |
| |
| | getRight () |
| |
| | getUp () |
| |
| | getForward () |
| |
| | getSouth () |
| |
| | getWest () |
| |
| | add ($x, $y=0, $z=0) |
| |
| | subtract ($x=0, $y=0, $z=0) |
| |
| | multiply ($number) |
| |
| | divide ($number) |
| |
| | ceil () |
| |
| | floor () |
| |
| | round () |
| |
| | abs () |
| |
| | getSide ($side, $step=1) |
| |
| | asVector3 () |
| |
| | distance (Vector3 $pos) |
| |
| | distanceSquared (Vector3 $pos) |
| |
| | maxPlainDistance ($x=0, $z=0) |
| |
| | length () |
| |
| | lengthSquared () |
| |
| | normalize () |
| |
| | dot (Vector3 $v) |
| |
| | cross (Vector3 $v) |
| |
| | equals (Vector3 $v) |
| |
| | getIntermediateWithXValue (Vector3 $v, $x) |
| |
| | getIntermediateWithYValue (Vector3 $v, $y) |
| |
| | getIntermediateWithZValue (Vector3 $v, $z) |
| |
| | setComponents ($x, $y, $z) |
| |
| | fromObjectAdd (Vector3 $pos, $x, $y, $z) |
| |
| | __toString () |
| |
◆ __construct()
| __construct |
( |
|
$x = 0, |
|
|
|
$y = 0, |
|
|
|
$z = 0 |
|
) |
| |
◆ __toString()
- Returns
- string
472 return "Vector3(x=" . $this->x .
",y=" . $this->y .
",z=" . $this->z .
")";
◆ abs()
◆ add()
| add |
( |
|
$x, |
|
|
|
$y = 0, |
|
|
|
$z = 0 |
|
) |
| |
- Parameters
-
- Returns
- Vector3
138 return new Vector3($this->x +
$x->x, $this->y +
$x->y, $this->z +
$x->z);
140 return new Vector3($this->x +
$x, $this->y +
$y, $this->z +
$z);
◆ asVector3()
◆ ceil()
◆ createRandomDirection()
| static createRandomDirection |
( |
Random |
$random | ) |
|
|
static |
◆ cross()
- Parameters
-
- Returns
- Vector3
343 $this->y * $v->z - $this->z * $v->y,
344 $this->z * $v->x - $this->x * $v->z,
345 $this->x * $v->y - $this->y * $v->x
◆ distance()
◆ distanceSquared()
- Parameters
-
- Returns
- number
282 return pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2);
◆ divide()
- Parameters
-
- Returns
- Vector3
174 return new Vector3($this->x / $number, $this->y / $number, $this->z / $number);
◆ dot()
- Parameters
-
- Returns
- int
333 return $this->x * $v->x + $this->y * $v->y + $this->z * $v->z;
◆ equals()
- Parameters
-
- Returns
- bool
355 return $this->x == $v->x and $this->y == $v->y and $this->z == $v->z;
◆ floor()
◆ fromObjectAdd()
| fromObjectAdd |
( |
Vector3 |
$pos, |
|
|
|
$x, |
|
|
|
$y, |
|
|
|
$z |
|
) |
| |
- Parameters
-
- Returns
- $this
462 $this->x = $pos->x +
$x;
463 $this->y = $pos->y +
$y;
464 $this->z = $pos->z +
$z;
◆ getFloorX()
- Returns
- int
77 return (
int)
floor($this->x);
◆ getFloorY()
- Returns
- int
84 return (
int)
floor($this->y);
◆ getFloorZ()
- Returns
- int
91 return (
int)
floor($this->z);
◆ getForward()
◆ getIntermediateWithXValue()
| getIntermediateWithXValue |
( |
Vector3 |
$v, |
|
|
|
$x |
|
) |
| |
Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- Parameters
-
- Returns
- Vector3
372 if(($xDiff * $xDiff) < 0.0000001){
378 if($f < 0 or $f > 1){
381 return new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);
◆ getIntermediateWithYValue()
| getIntermediateWithYValue |
( |
Vector3 |
$v, |
|
|
|
$y |
|
) |
| |
Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- Parameters
-
- Returns
- Vector3
399 if(($yDiff * $yDiff) < 0.0000001){
405 if($f < 0 or $f > 1){
408 return new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);
◆ getIntermediateWithZValue()
| getIntermediateWithZValue |
( |
Vector3 |
$v, |
|
|
|
$z |
|
) |
| |
Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- Parameters
-
- Returns
- Vector3
426 if(($zDiff * $zDiff) < 0.0000001){
432 if($f < 0 or $f > 1){
435 return new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);
◆ getOppositeSide()
| static getOppositeSide |
( |
|
$side | ) |
|
|
static |
Returns the Vector3 side number opposite the specified one
- Parameters
-
| int | $side | 0-5 one of the Vector3::SIDE_* constants |
- Returns
- int
- Exceptions
-
◆ getRight()
◆ getSide()
| getSide |
( |
|
$side, |
|
|
|
$step = 1 |
|
) |
| |
- Parameters
-
- Returns
- $this|Vector3
214 return new Vector3($this->x, $this->y - $step, $this->z);
216 return new Vector3($this->x, $this->y + $step, $this->z);
218 return new Vector3($this->x, $this->y, $this->z - $step);
220 return new Vector3($this->x, $this->y, $this->z + $step);
222 return new Vector3($this->x - $step, $this->y, $this->z);
224 return new Vector3($this->x + $step, $this->y, $this->z);
◆ getSouth()
◆ getUp()
◆ getWest()
◆ getX()
◆ getY()
◆ getZ()
◆ length()
◆ lengthSquared()
- Returns
- int
312 return $this->x * $this->x + $this->y * $this->y + $this->z *
$this->z;
◆ maxPlainDistance()
| maxPlainDistance |
( |
|
$x = 0, |
|
|
|
$z = 0 |
|
) |
| |
- Parameters
-
- Returns
- mixed
294 }elseif(
$x instanceof Vector2){
297 return max(
abs($this->x -
$x),
abs($this->z -
$z));
◆ multiply()
- Parameters
-
- Returns
- Vector3
165 return new Vector3($this->x * $number, $this->y * $number, $this->z * $number);
◆ normalize()
◆ round()
◆ setComponents()
| setComponents |
( |
|
$x, |
|
|
|
$y, |
|
|
|
$z |
|
) |
| |
◆ subtract()
| subtract |
( |
|
$x = 0, |
|
|
|
$y = 0, |
|
|
|
$z = 0 |
|
) |
| |
◆ $x
◆ $y
◆ $z
◆ SIDE_DOWN
◆ SIDE_EAST
◆ SIDE_NORTH
◆ SIDE_SOUTH
◆ SIDE_UP
◆ SIDE_WEST
The documentation for this class was generated from the following file:
- src/pocketmine/math/Vector3.php