Vec2

Vec2 is a two component floating-point vector value type.

function Vec2(Float x, Float y) → Vec2

Return a Vec2 with the specified x and y values.

This is equivalent to setting the values eplicitly. For example, these two lines have the same effect:

v.x = 10; v.y = 11.1
v = Vec2(10, 11.1)

property Float x

property Float y

The x and y components.

property Float lengthread only

Returns the vector length.

function dot(Vec2 other) → Float

Returns dot product of this vector and other.

function normalized() → Vec2

Returns a vector that points in the same direction but with a length of 1.

If this is a null vector, and thus has no direction, a null vector is returned.