small tweaks

This commit is contained in:
GameHerobrine 2024-01-01 08:38:39 +03:00
parent 68b8232f07
commit 6594e7d0ef
4 changed files with 31 additions and 38 deletions

View file

@ -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;

View file

@ -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);
}
}