mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
small tweaks
This commit is contained in:
parent
68b8232f07
commit
6594e7d0ef
4 changed files with 31 additions and 38 deletions
|
|
@ -26,7 +26,7 @@ class Vector2{
|
|||
}
|
||||
|
||||
public function subtract($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
if($x instanceof Vector2){
|
||||
return $this->add(-$x->x, -$x->y);
|
||||
}else{
|
||||
return $this->add(-$x, -$y);
|
||||
|
|
@ -34,7 +34,7 @@ class Vector2{
|
|||
}
|
||||
|
||||
public function add($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
if($x instanceof Vector2){
|
||||
return $this->add($x->x, $x->y);
|
||||
}else{
|
||||
$this->x += $x;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class Vector3{
|
|||
if(($x instanceof Vector3) === true){
|
||||
return $this->distanceSquared($x->x, $x->y, $x->z);
|
||||
}else{
|
||||
return pow($this->x - $x, 2) + pow($this->y - $y, 2) + pow($this->z - $z, 2);
|
||||
return ($this->x - $x)*($this->x - $x) + ($this->y - $y)*($this->y - $y) + ($this->z - $z)*($this->z - $z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue