Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Point3D Class Reference

Public Member Functions

 __construct (float $x=0, float $y=0, float $z=0)
 
 multiply ($arg)
 
 distance (Point3D $dest)
 
 add ($other_point3d_or_x, float $y=null, float $z=null)
 
 lookAt (Point3D $b)
 
 subtract ($other_point3d_or_x, float $y=null, float $z=null)
 
 floor ()
 
 round ()
 
 ceil ()
 
 block ()
 
 blockCenter ()
 
 equals (Point3D $b)
 
 invert ()
 
 __toString ()
 

Static Public Member Functions

static getUnitVector (float $yaw, float $pitch)
 

Public Attributes

 $x = 0
 
 $y = 0
 
 $z = 0
 

Detailed Description

A point in three-dimensional space, or a three-dimensional vector. Whatever you want it to be.

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Point3D::__construct ( float  $x = 0,
float  $y = 0,
float  $z = 0 
)

Member Function Documentation

◆ __toString()

Phpcraft\Point3D::__toString ( )

◆ add()

Phpcraft\Point3D::add (   $other_point3d_or_x,
float  $y = null,
float  $z = null 
)
Parameters
Point3D | float$other_point3d_or_x
float$y
float$z
Returns
Point3D

◆ block()

Phpcraft\Point3D::block ( )

Floors all axes and adds 0.5 to the X & Z axes.

Returns
Point3D

◆ blockCenter()

Phpcraft\Point3D::blockCenter ( )

Floors and adds 0.5 to all axes.

Returns
Point3D

◆ ceil()

Phpcraft\Point3D::ceil ( )

◆ distance()

Phpcraft\Point3D::distance ( Point3D  $dest)

◆ equals()

Phpcraft\Point3D::equals ( Point3D  $b)

◆ floor()

Phpcraft\Point3D::floor ( )

◆ getUnitVector()

static Phpcraft\Point3D::getUnitVector ( float  $yaw,
float  $pitch 
)
static

◆ invert()

Phpcraft\Point3D::invert ( )

◆ lookAt()

Phpcraft\Point3D::lookAt ( Point3D  $b)
Parameters
Point3D$b
Returns
float[] Yaw & pitch

◆ multiply()

Phpcraft\Point3D::multiply (   $arg)
Parameters
Point3D | int | float | string$argPoint3D or numeric
Returns
Point3D

◆ round()

Phpcraft\Point3D::round ( )

◆ subtract()

Phpcraft\Point3D::subtract (   $other_point3d_or_x,
float  $y = null,
float  $z = null 
)
Parameters
Point3D | float$other_point3d_or_x
float$y
float$z
Returns
Point3D

Member Data Documentation

◆ $x

double Phpcraft\Point3D::$x = 0

◆ $y

double Phpcraft\Point3D::$y = 0

◆ $z

double Phpcraft\Point3D::$z = 0