Vec2
- class cee.Vec2()
An immutable 2d vector with x, y values.
Used e.g. for texture coordinates
Constructors
Methods
Constructors
- Vec2.constructor(x, y)
- Arguments:
x (
number
) – Noney (
number
) – None
Constructor
- Return type:
Vec2
Properties
- Vec2.x
- Type:
number
The x coordinate of the vector
- Vec2.y
- Type:
number
The y coordinate of the vector
Methods
equals
getLength
- Vec2.getLength()
Returns the length of the vector (sqrt(x^2 + y^2)).
- Return type:
number
getLengthSquared
- Vec2.getLengthSquared()
Returns the squared length of the vector
- Return type:
number
getNegated
- Vec2.getNegated()
Returns a negated version of the vector.
- Return type:
Vec2
getNormalized
- Vec2.getNormalized()
Returns a normalized version of the vector.
- Return type:
Vec2
static add
static dot
static from
static fromArray
- Vec2.fromArray(arr)
- Arguments:
arr (
ArrayLike
) – None
Creates a new Vec2 instance from the first 2 elements of the given array.
- Return type:
Vec2