Vector

Generic 1D small vector.

Constructors

this
this(X x_, Y y_)

Creates a vector of 2 elements.

this
this(X x_, Y y_, Z z_)

Creates a vector of 3 elements.

this
this(Vector!(X, 2) xy_, Y z_)

Creates a vector of 3 elements.

this
this(X x_, Vector!(Y, 2) yz_)

Creates a vector of 3 elements.

this
this(X x_, Y y_, Z z_, W w_)

Creates a vector of 4 elements.

this
this(Vector!(X, 2) xy_, Vector!(Y, 2) zw_)

Creates a vector of 4 elements.

this
this(Vector!(X, 2) xy_, Y z_, Z w_)

Creates a vector of 4 elements.

this
this(Vector!(X, 3) xyz_, Y w_)

Creates a vector of 4 elements.

this
this(X x_, Vector!(X, 3) yzw_)

Creates a vector of 4 elements.

this
this(U x)

Construct a Vector from a value.

Members

Functions

distanceTo
T distanceTo(Vector other)
getOrthogonalVector
Vector getOrthogonalVector()

Gets an orthogonal vector from a 3-dimensional vector. Doesn’t normalise the output.

length
T length()
normalize
void normalize()

In-place normalization.

normalized
Vector normalized()
opAssign
Vector opAssign(U x)

Assign a Vector from a compatible type.

opAssign
Vector opAssign(U arr)

Assign a Vector with a static array type.

opAssign
Vector opAssign(U arr)

Assign with a dynamic array. Size is checked in debug-mode.

opAssign
Vector opAssign(U u)

Assign from a samey Vector.

opAssign
Vector opAssign(U x)

Assign from other vectors types (same size, compatible type).

opBinary
Vector opBinary(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinaryRight
Vector opBinaryRight(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
U opCast()

Casting to small vectors of the same size.

opDollar
int opDollar()

Implement slices operator overloading. Allows to go back to slice world.

opEquals
bool opEquals(U other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(U other)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
T opIndex(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
const(T) opIndex(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndexAssign
T opIndexAssign(U x, size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Vector opOpAssign(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Vector opOpAssign(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
opSlice
T[] opSlice()
opSlice
T[] opSlice(int a, int b)
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.
ptr
inout(T)* ptr()
squaredDistanceTo
T squaredDistanceTo(Vector v)
Undocumented in source. Be warned that the author may not have intended to support it.
squaredLength
T squaredLength()
toString
string toString()

Converts to a pretty string.

Properties

opDispatch
auto opDispatch [@property getter]

Implements swizzling.

opDispatch
U opDispatch [@property setter]

Support swizzling assignment like in shader languages.

Unions

__anonymous
union __anonymous
Undocumented in source.

Parameters

N

number of elements

T

type of elements

Meta