Documentation

Vector3
in package

Table of Contents

$x  : float|int
$y  : float|int
$z  : float|int
__construct()  : mixed
__toString()  : mixed
abs()  : Vector3
add()  : Vector3
addVector()  : Vector3
asVector3()  : Vector3
Return a Vector3 instance
ceil()  : Vector3
cross()  : Vector3
distance()  : float
distanceSquared()  : float
divide()  : Vector3
dot()  : float
down()  : Vector3
east()  : Vector3
equals()  : bool
floor()  : Vector3
getFloorX()  : int
getFloorY()  : int
getFloorZ()  : int
getIntermediateWithXValue()  : Vector3|null
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.
getIntermediateWithYValue()  : Vector3|null
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.
getIntermediateWithZValue()  : Vector3|null
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.
getSide()  : Vector3
getX()  : float|int
getY()  : float|int
getZ()  : float|int
length()  : float
lengthSquared()  : float
maxComponents()  : Vector3
Returns a new Vector3 taking the maximum of each component in the input vectors.
maxPlainDistance()  : float
minComponents()  : Vector3
Returns a new Vector3 taking the minimum of each component in the input vectors.
multiply()  : Vector3
normalize()  : Vector3
north()  : Vector3
round()  : Vector3
sides()  : Generator|array<string|int, Vector3>
Yields vectors stepped out from this one in all directions.
sidesAroundAxis()  : Generator|array<string|int, Vector3>
Yields vectors stepped out from this one in directions except those on the given axis.
sidesArray()  : array<string|int, Vector3>
Same as sides() but returns a pre-populated array instead of Generator.
south()  : Vector3
subtract()  : Vector3
subtractVector()  : Vector3
sum()  : Vector3
up()  : Vector3
west()  : Vector3
withComponents()  : Vector3
Returns a Vector3 with the provided components. If any of the components are null, the values from this Vector3 will be filled in instead.
zero()  : Vector3

Properties

Methods

__construct()

public __construct(float|int $x, float|int $y, float|int $z) : mixed
Parameters
$x : float|int
$y : float|int
$z : float|int
Return values
mixed

__toString()

public __toString() : mixed
Return values
mixed

add()

public add(float|int $x, float|int $y, float|int $z) : Vector3
Parameters
$x : float|int
$y : float|int
$z : float|int
Return values
Vector3

distanceSquared()

public distanceSquared(Vector3 $pos) : float
Parameters
$pos : Vector3
Return values
float

getFloorX()

public getFloorX() : int
Return values
int

getFloorY()

public getFloorY() : int
Return values
int

getFloorZ()

public getFloorZ() : int
Return values
int

getIntermediateWithXValue()

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.

public getIntermediateWithXValue(Vector3 $v, float $x) : Vector3|null
Parameters
$v : Vector3
$x : float
Return values
Vector3|null

getIntermediateWithYValue()

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.

public getIntermediateWithYValue(Vector3 $v, float $y) : Vector3|null
Parameters
$v : Vector3
$y : float
Return values
Vector3|null

getIntermediateWithZValue()

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.

public getIntermediateWithZValue(Vector3 $v, float $z) : Vector3|null
Parameters
$v : Vector3
$z : float
Return values
Vector3|null

getSide()

public getSide(int $side[, int $step = 1 ]) : Vector3
Parameters
$side : int
$step : int = 1
Return values
Vector3

getX()

public getX() : float|int
Return values
float|int

getY()

public getY() : float|int
Return values
float|int

getZ()

public getZ() : float|int
Return values
float|int

length()

public length() : float
Return values
float

lengthSquared()

public lengthSquared() : float
Return values
float

maxComponents()

Returns a new Vector3 taking the maximum of each component in the input vectors.

public static maxComponents(Vector3 $vector, Vector3 ...$vectors) : Vector3
Parameters
$vector : Vector3
$vectors : Vector3
Return values
Vector3

minComponents()

Returns a new Vector3 taking the minimum of each component in the input vectors.

public static minComponents(Vector3 $vector, Vector3 ...$vectors) : Vector3
Parameters
$vector : Vector3
$vectors : Vector3
Return values
Vector3

round()

public round([int $precision = 0 ][, int $mode = PHP_ROUND_HALF_UP ]) : Vector3
Parameters
$precision : int = 0
$mode : int = PHP_ROUND_HALF_UP
Return values
Vector3

sides()

Yields vectors stepped out from this one in all directions.

public sides([int $step = 1 ]) : Generator|array<string|int, Vector3>
Parameters
$step : int = 1

Distance in each direction to shift the vector

Tags
phpstan-return

\Generator<int, Vector3, void, void>

Return values
Generator|array<string|int, Vector3>

sidesAroundAxis()

Yields vectors stepped out from this one in directions except those on the given axis.

public sidesAroundAxis(int $axis[, int $step = 1 ]) : Generator|array<string|int, Vector3>
Parameters
$axis : int

Facing directions on this axis will be excluded

$step : int = 1
Tags
phpstan-return

\Generator<int, Vector3, void, void>

Return values
Generator|array<string|int, Vector3>

sidesArray()

Same as sides() but returns a pre-populated array instead of Generator.

public sidesArray([bool $keys = false ][, int $step = 1 ]) : array<string|int, Vector3>
Parameters
$keys : bool = false
$step : int = 1
Return values
array<string|int, Vector3>

subtract()

public subtract(float|int $x, float|int $y, float|int $z) : Vector3
Parameters
$x : float|int
$y : float|int
$z : float|int
Return values
Vector3

withComponents()

Returns a Vector3 with the provided components. If any of the components are null, the values from this Vector3 will be filled in instead.

public withComponents(float|int|null $x, float|int|null $y, float|int|null $z) : Vector3

If no components are overridden (all components are null), the original vector will be returned unchanged.

Parameters
$x : float|int|null
$y : float|int|null
$z : float|int|null
Return values
Vector3

Search results