Vector

Generic 1D small vector.

Constructors

this
this(Args args)

Construct a Vector with a T[] or the values as arguments

Members

Aliases

fastInverseLength
alias fastInverseLength = fastInverseMagnitude
Undocumented in source.

Functions

distanceTo
T distanceTo(Vector other)

Euclidean distance between this vector and another one

fastInverseMagnitude
T fastInverseMagnitude()

Faster but less accurate inverse of Euclidean length.

fastNormalize
void fastNormalize()

Faster but less accurate in-place normalization.

fastNormalized
Vector fastNormalized()

Faster but less accurate vector normalization.

getOrthogonalVector
Vector getOrthogonalVector()

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

inverseMagnitude
T inverseMagnitude()

Inverse Euclidean length of the vector

magnitude
T magnitude()

Euclidean length of the vector

normalize
void normalize()

In-place normalization.

normalized
Vector normalized()

Returns a normalized copy of this Vector

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()

Slice containing vector values

opSlice
T[] opSlice(int a, int b)

veca..b

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)

Squared Euclidean distance between this vector and another one

squaredMagnitude
T squaredMagnitude()

Squared Euclidean length of the Vector

toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
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