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(Vector2!(U) vec)

CTor

Members

Aliases

dot
alias dot = scalar

alias for scalar

Functions

angle
float angle(Vector2!(T) 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.

diff
float diff(Vector2!(T) vec)

Calculate the diff between two vectors.

isEmpty
bool isEmpty()

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

normalize
Vector2!(T) normalize()

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

opBinary
Vector2!(T) opBinary(Vector2!(T) vec)

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

opBinary
Vector2!(T) opBinary(float num)

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

opEquals
bool opEquals(Vector2!(T) vec)

Compares two vectors by checking whether the coordinates are equals.

opNeg
Vector2!(T) opNeg()

Returns a negated copy of this Vector.

opOpAssign
Vector2!(T) opOpAssign(Vector2!(T) vec)

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

opOpAssign
Vector2!(T) opOpAssign(float num)

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

scalar
float scalar(Vector2!(T) vec)

Calculate the scalar product.

Properties

length
float length [@property getter]

Calculate the length.

Variables

x
T x;

The x coordinate

y
T y;

The y coordinate

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)