mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fixed TABS
This commit is contained in:
parent
b3b38605b5
commit
aa1a39adfc
41 changed files with 549 additions and 549 deletions
|
|
@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
|
||||
class Vector2{
|
||||
public $x, $y;
|
||||
|
||||
|
||||
public function __construct($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
$this->__construct($x->x, $x->y);
|
||||
|
|
@ -36,23 +36,23 @@ class Vector2{
|
|||
$this->y = $y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getX(){
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
|
||||
public function getY(){
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
|
||||
public function getFloorX(){
|
||||
return (int) $this->x;
|
||||
}
|
||||
|
||||
|
||||
public function getFloorY(){
|
||||
return (int) $this->y;
|
||||
}
|
||||
|
||||
|
||||
public function add($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
return $this->add($x->x, $x->y);
|
||||
|
|
@ -62,7 +62,7 @@ class Vector2{
|
|||
return new Vector3($this->x + $x, $this->y + $y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function subtract($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
return $this->add(-$x->x, -$x->y);
|
||||
|
|
@ -70,23 +70,23 @@ class Vector2{
|
|||
return $this->add(-$x, -$y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ceil(){
|
||||
return new Vector2((int) ($this->x + 1), (int) ($this->y + 1));
|
||||
}
|
||||
|
||||
|
||||
public function floor(){
|
||||
return new Vector2((int) $this->x, (int) $this->y);
|
||||
}
|
||||
|
||||
|
||||
public function round(){
|
||||
return new Vector2(round($this->x), round($this->y));
|
||||
}
|
||||
|
||||
|
||||
public function abs(){
|
||||
return new Vector2(abs($this->x), abs($this->y));
|
||||
}
|
||||
|
||||
|
||||
public function distance($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
return sqrt($this->distanceSquared($x->x, $x->y));
|
||||
|
|
@ -94,7 +94,7 @@ class Vector2{
|
|||
return sqrt($this->distanceSquared($x, $y));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function distanceSquared($x = 0, $y = 0){
|
||||
if(($x instanceof Vector2) === true){
|
||||
return $this->distanceSquared($x->x, $x->y);
|
||||
|
|
@ -102,9 +102,9 @@ class Vector2{
|
|||
return pow($this->x - $x, 2) + pow($this->y - $y, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function __toString(){
|
||||
return "Vector2(x=".$this->x.",y=".$this->y.")";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue