Vector2

Vector2 is a structure that defines a two-dimensional point.

Constructors

this
this(T x, T y)

CTor

this
this(U x, U y)

CTor

this
this(U[2] pos)

CTor

this
this(Vector2!U vec)

CTor

Members

Aliases

dot
alias dot = scalar

alias for scalar

Functions

angle
float angle(Vector2 vec, bool degrees)

Calculate the angle between two vectors. If the second paramter is true, the return value is converted to degrees. Otherwise, radiant is used.

asArray
T[2] asArray()

Returns the Vector as static array.

diff
float diff(Vector2 vec)

Calculate the diff between two vectors.

isEmpty
bool isEmpty()

Checks if this vector is empty. This means that his coordinates are 0.

move
void move(T x, T y)

Move the current coordinates.

negate
void negate()

Negate this Vector

normalize
Vector2 normalize()

Normalize the vector in which the coordinates are divided by the length.

opBinary
Vector2 opBinary(Vector2 vec)

Supported operation: +, -, *, / and %

opBinary
Vector2 opBinary(T number)

Supported operation: +, -, *, / and %

opEquals
bool opEquals(Vector2 vec)

Compares two vectors by checking whether the coordinates are equals.

opNeg
Vector2 opNeg()

Returns a negated copy of this Vector.

opOpAssign
Vector2 opOpAssign(Vector2 vec)

Supported operation: +=, -=, *=, /= and %=

opOpAssign
Vector2 opOpAssign(T number)

Supported operation: +=, -=, *=, /= and %=

scalar
float scalar(Vector2 vec)

Calculate the scalar product.

set
void set(T x, T y)

Set new coordinates.

Properties

length
float length [@property getter]

Calculate the length.

Variables

x
T x;

x coordinate

y
T y;

y coordinate

Meta

Authors

rschuett