Vector

A 2D vector with an arbitrary numeric type

Constructors

this
this(float x, float y)

Create a vector with an x and a y

Members

Functions

clamp
Vector clamp(in Vector min, in Vector max)

Clamp a vector somewhere between a minimum and a maximum

cross
float cross(in Vector other)

Get the cross product of a vector

dot
float dot(in Vector other)

Get the dot product of a vector

normalize
Vector normalize()

Normalize the vector's length from [0, 1]

Properties

inverse
Vector inverse [@property getter]

Get the vector equal to Vector(1 / x, 1 / y)

len
float len [@property getter]

Get the length of the vector

len2
float len2 [@property getter]

Get the squared length of the vector (faster than getting the length)

xComp
Vector xComp [@property getter]

Get only the X component of the Vector, represented as a vector

yComp
Vector yComp [@property getter]

Get only the Y component of the Vector, represented as a vector

Meta