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(Vector min, Vector max)

Clamp a vector somewhere between a minimum and a maximum

cross
float cross(Vector other)

Get the cross product of a vector

dot
float dot(Vector other)

Get the dot product of a vector

normalize
Vector normalize()

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

opBinary
Vector opBinary(float scalar)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
Vector opBinary(Vector other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Vector other)
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
Vector opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
print
void print()
Undocumented in source. Be warned that the author may not have intended to support it.

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

Variables

x
float x;
y
float y;
Undocumented in source.

Meta