mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +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 Vector3{
|
||||
public $x, $y, $z;
|
||||
|
||||
|
||||
public function __construct($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
$this->__construct($x->x, $x->y, $x->z);
|
||||
|
|
@ -37,51 +37,51 @@ class Vector3{
|
|||
$this->z = $z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getX(){
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
|
||||
public function getY(){
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
|
||||
public function getZ(){
|
||||
return $this->z;
|
||||
}
|
||||
|
||||
|
||||
public function getFloorX(){
|
||||
return (int) $this->x;
|
||||
}
|
||||
|
||||
|
||||
public function getFloorY(){
|
||||
return (int) $this->y;
|
||||
}
|
||||
|
||||
|
||||
public function getFloorZ(){
|
||||
return (int) $this->z;
|
||||
}
|
||||
|
||||
|
||||
public function getRight(){
|
||||
return $this->getX();
|
||||
}
|
||||
|
||||
|
||||
public function getUp(){
|
||||
return $this->getY();
|
||||
}
|
||||
|
||||
|
||||
public function getForward(){
|
||||
return $this->getZ();
|
||||
}
|
||||
|
||||
|
||||
public function getSouth(){
|
||||
return $this->getX();
|
||||
}
|
||||
|
||||
|
||||
public function getWest(){
|
||||
return $this->getZ();
|
||||
}
|
||||
|
||||
|
||||
public function add($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
return $this->add($x->x, $x->y, $x->z);
|
||||
|
|
@ -92,7 +92,7 @@ class Vector3{
|
|||
return new Vector3($this->x + $x, $this->y + $y, $this->z + $z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function subtract($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
return $this->add(-$x->x, -$x->y, -$x->z);
|
||||
|
|
@ -100,23 +100,23 @@ class Vector3{
|
|||
return $this->add(-$x, -$y, -$z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ceil(){
|
||||
return new Vector3((int) ($this->x + 1), (int) ($this->y + 1), (int) ($this->z + 1));
|
||||
}
|
||||
|
||||
|
||||
public function floor(){
|
||||
return new Vector3((int) $this->x, (int) $this->y, (int) $this->z);
|
||||
}
|
||||
|
||||
|
||||
public function round(){
|
||||
return new Vector3(round($this->x), round($this->y), round($this->z));
|
||||
}
|
||||
|
||||
|
||||
public function abs(){
|
||||
return new Vector3(abs($this->x), abs($this->y), abs($this->z));
|
||||
}
|
||||
|
||||
|
||||
public function distance($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
return sqrt($this->distanceSquared($x->x, $x->y, $x->z));
|
||||
|
|
@ -124,7 +124,7 @@ class Vector3{
|
|||
return sqrt($this->distanceSquared($x, $y, $z));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function distanceSquared($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
return $this->distanceSquared($x->x, $x->y, $x->z);
|
||||
|
|
@ -132,9 +132,9 @@ class Vector3{
|
|||
return pow($this->x - $x, 2) + pow($this->y - $y, 2) + pow($this->z - $z, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function __toString(){
|
||||
return "Vector3(x=".$this->x.",y=".$this->y.",z=".$this->z.")";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue