Vec3
-
class
cee.Vec3() An immutable 3d vector with x, y and z values.
Used for positions, normals and other 3d entities.
Constructors
-
cee.Vec3.constructor() - Vec3(x: number, y: number, z: number):
Vec3Constructor
Parameters
x: number
y: number
z: number
Returns:
Vec3
Properties
-
cee.Vec3.x readonly
x: numberThe x coordinate of the vector
-
cee.Vec3.y readonly
y: numberThe y coordinate of the vector
-
cee.Vec3.z readonly
z: numberThe z coordinate of the vector
Methods
-
cee.Vec3.equals() - equals(other:
Vec3Like): booleanReturns true if the vectors are equal
Parameters
other:Vec3LikeReturns: boolean
-
cee.Vec3.getLength() - getLength(): number
Returns the length of the vector (sqrt(x^2 + y^2 + z^2)).
Returns: number
-
cee.Vec3.getLengthSquared() - getLengthSquared(): number
Returns the squared length of the vector
Returns: number
-
cee.Vec3.getNormalized() - getNormalized():
Vec3Returns a normalized version of the vector.
Returns:
Vec3
-
cee.Vec3.getPointDistance() - getPointDistance(otherPoint:
Vec3): numberReturns the distance between this point and otherPoint
Parameters
otherPoint:Vec3Returns: number
-
cee.Vec3.getPointDistanceSquared() - getPointDistanceSquared(otherPoint:
Vec3Like): numberReturns the squared distance between this point and otherPoint
Parameters
otherPoint:Vec3LikeReturns: number
-
static cee.Vec3.dot() static
Returns the dot product of the 2 vectors
Parameters
Returns: number
-
static cee.Vec3.from() static
Creates a new Vec3 instance from any object with x, y and z properties.
Parameters
vec:Vec3LikeReturns:
Vec3
-
static cee.Vec3.fromArray() static
fromArray(arr: ArrayLike):Vec3Creates a new Vec3 instance from the first 3 elements of the given array.
Parameters
arr: ArrayLikeReturns:
Vec3
-
static cee.Vec3.negate() static
Returns the negation of the given vector
Parameters
vec:Vec3LikeReturns:
Vec3
-
static cee.Vec3.scale() static
Returns the result of scaling the given vector by the given factor
Parameters
vec:
Vec3Likefactor: number
Returns:
Vec3
-
static cee.Vec3.sub() static
Returns the result of subtracting vector b from vector a
Parameters
Returns:
Vec3
-
static cee.Vec3.transformPoint() static
Returns a new vector with the given vector transforms as a point.
Transforms the vector as a point by multiplying it with the given matrix. This will both rotate and translate the vector p. Assumes the matrix m doesn’t contain any perspective projection.
Parameters
Returns:
Vec3
-
static cee.Vec3.transformVector() static
Returns a new vector with the given vector transforms as a vector.
Transforms the vector as a vector by multiplying it with the given matrix. This will only rotate the vector. The translation part of the matrix will be ignored. Assumes the matrix m doesn’t contain any perspective projection.
Parameters
Returns:
Vec3