Vec2
-
class
cee.Vec2() An immutable 2d vector with x, y values.
Used e.g. for texture coordinates
Constructors
-
cee.Vec2.constructor() - Vec2(x: number, y: number):
Vec2Constructor
Parameters
x: number
y: number
Returns:
Vec2
Properties
-
cee.Vec2.x readonly
x: numberThe x coordinate of the vector
-
cee.Vec2.y readonly
y: numberThe y coordinate of the vector
Methods
-
cee.Vec2.equals() - equals(other:
Vec2Like): booleanReturns true if the vectors are equal
Parameters
other:Vec2LikeReturns: boolean
-
cee.Vec2.getLength() - getLength(): number
Returns the length of the vector (sqrt(x^2 + y^2)).
Returns: number
-
cee.Vec2.getLengthSquared() - getLengthSquared(): number
Returns the squared length of the vector
Returns: number
-
cee.Vec2.getNormalized() - getNormalized():
Vec2Returns a normalized version of the vector.
Returns:
Vec2
-
static cee.Vec2.dot() static
Returns the dot product of the 2 vectors
Parameters
Returns: number
-
static cee.Vec2.from() static
Creates a new Vec2 instance from any object with x and y properties.
Parameters
vec:Vec2LikeReturns:
Vec2
-
static cee.Vec2.fromArray() static
fromArray(arr: ArrayLike):Vec2Creates a new Vec2 instance from the first 2 elements of the given array.
Parameters
arr: ArrayLikeReturns:
Vec2
-
static cee.Vec2.negate() static
Returns the negation of the given vector
Parameters
vec:Vec2LikeReturns:
Vec2