Dgame.Math.Vector2

« Go back

Bottom


struct Vector2(T) if (isNumeric!T);
Vector2 is a structure that defines a two-dimensional point.

Author:
Randy Schuett (rswhite4@googlemail.com)

T x;
The x coordinate

T y;
The y coordinate

pure nothrow @nogc this(T x, T y);
CTor

pure nothrow @nogc this(U)(U x, U y) if (isNumeric!U && !is(U == T));
CTor

pure nothrow @nogc this(U)(const Vector2!U vec) if (!is(U == T));
CTor

pure nothrow @nogc ref Vector2!T opOpAssign(string op)(const Vector2!T vec);
Supported operation: +=, -=, *=, /= and %=

pure nothrow @nogc ref Vector2!T opOpAssign(string op)(float num);
Supported operation: +=, -=, *=, /= and %=

const pure nothrow @nogc Vector2!T opBinary(string op)(const Vector2!T vec);
Supported operation: +, -, *, / and %

const pure @nogc Vector2!T opBinary(string op)(float num);
Supported operation: +, -, *, / and %

const pure nothrow @nogc Vector2!T opNeg();
Returns a negated copy of this Vector.

const pure nothrow @nogc bool opEquals(const Vector2!T vec);
Compares two vectors by checking whether the coordinates are equals.

const pure nothrow @nogc bool isEmpty();
Checks if this vector is empty. This means that his coordinates are 0.

const pure nothrow @nogc float scalar(const Vector2!T vec);
Calculate the scalar product.

alias dot = scalar;
alias for scalar

const pure nothrow @nogc @property float length();
Calculate the length.

const pure nothrow @nogc float angle(const Vector2!T vec, bool degrees = true);
Calculate the angle between two vectors. If the second paramter is true, the return value is converted to degrees. Otherwise, radiant is used.

const pure nothrow @nogc float diff(const Vector2!T vec);
Calculate the diff between two vectors.

pure nothrow @nogc ref Vector2!T normalize();
Normalize the vector in which the coordinates are divided by the length.

alias Vector2f = Vector2!float.Vector2;
A float representation

alias Vector2i = Vector2!int.Vector2;
An int representation


Page generated by Ddoc.

» Dgame.Math.Vector2 on Github

Top

« Go back