Vec3
Last updated
A point in 3d space.
new Vec3(
x,y,z):Vec3
Creates a new Vec3 instance with the given coordinates
Parameters
x
number
y
number
z
number
Returns
Vec3
add(
vec3):Vec3
Adds another vector to this one
Parameters
vec3
Vec3
The vector to add
Returns
Vec3
A new vector representing the sum
distanceTo(
vec3):number
Calculates the distance to another vector
Parameters
vec3
Vec3
The vector to calculate distance to
Returns
number
The distance between the two vectors
getLength():
number
Gets the length/magnitude of this vector
Returns
number
The vector length
getX():
number
Gets the X coordinate
Returns
number
The X coordinate
getY():
number
Gets the Y coordinate
Returns
number
The Y coordinate
getZ():
number
Gets the Z coordinate
Returns
number
The Z coordinate
normalize():
Vec3
Normalizes this vector to have a length of 1
Returns
Vec3
A new normalized vector
subtract(
vec3):Vec3
Subtracts another vector from this one
Parameters
vec3
Vec3
The vector to subtract
Returns
Vec3
A new vector representing the difference
Last updated