◆ __construct()
__construct |
( |
|
$x = 0 , |
|
|
|
$y = 0 |
|
) |
| |
◆ __toString()
- Returns
- string
210 return "Vector2(x=" . $this->x .
",y=" . $this->y .
")";
◆ abs()
- Returns
- Vector2
122 return new Vector2(
abs($this->x),
abs($this->y));
◆ add()
- Parameters
-
- Returns
- Vector2
76 if(
$x instanceof Vector2){
77 return $this->
add(
$x->x,
$x->y);
79 return new Vector2($this->x +
$x, $this->y +
$y);
◆ ceil()
- Returns
- Vector2
101 return new Vector2((
int) ($this->x + 1), (
int) ($this->y + 1));
◆ createRandomDirection()
static createRandomDirection |
( |
Random |
$random | ) |
|
|
static |
◆ distance()
- Parameters
-
- Returns
- float
150 if(
$x instanceof Vector2){
◆ distanceSquared()
distanceSquared |
( |
|
$x, |
|
|
|
$y = 0 |
|
) |
| |
- Parameters
-
- Returns
- number
164 if(
$x instanceof Vector2){
167 return pow($this->x -
$x, 2) + pow($this->y -
$y, 2);
◆ divide()
- Parameters
-
- Returns
- Vector2
140 return new Vector2($this->x / $number, $this->y / $number);
◆ dot()
- Parameters
-
- Returns
- int
203 return $this->x * $v->x + $this->y * $v->y;
◆ floor()
- Returns
- Vector2
108 return new Vector2((
int) $this->x, (
int) $this->y);
◆ getFloorX()
◆ getFloorY()
◆ getX()
◆ getY()
◆ length()
◆ lengthSquared()
- Returns
- int
182 return $this->x * $this->x + $this->y *
$this->y;
◆ multiply()
- Parameters
-
- Returns
- Vector2
131 return new Vector2($this->x * $number, $this->y * $number);
◆ normalize()
- Returns
- Vector2
191 return $this->
divide(sqrt($len));
194 return new Vector2(0, 0);
◆ round()
◆ subtract()
- Parameters
-
- Returns
- Vector2
90 if(
$x instanceof Vector2){
91 return $this->
add(-
$x->x, -
$x->y);
◆ $x
◆ $y
The documentation for this class was generated from the following file:
- src/pocketmine/math/Vector2.php