Vector

Base template for all vector-types.

Constructors

this
this(Args args)

Constructs the vector If a single value is passed the vector, the vector will be cleared with this value If a vector with a higher dimension is passed the vector will hold the first values up to its dimension If mixed types are passed they will be joined together ( allowed types: vector, static array, $( I vt ))

this
this(V vec)

Construct a Vector from another Vector

this
this(valueType value)

Construct a Vector from a single value

Members

Aliases

dimension
alias dimension = dim
Undocumented in source.
valueType
alias valueType = type
Undocumented in source.

Functions

clear
void clear(valueType value)

Sets all values of the vector to value

length
auto length()

Returns the euclidean length of the vector

ok
bool ok()

FloatingPoint valueType, Returns true if all values are not nan and finite, otherwise false

opBinary
Vector opBinary(valueType s)

Componentwise binary vector-skalar operation: addition, subtraction, multiplication, division

opBinary
Vector opBinary(Vector v)

Componentwise binary operation with aonther vector: addition, subtraction, multiplication, division

opBinaryRight
auto opBinaryRight(valueType s)

Componentwise binary skalar-vector operation: addition, subtraction, multiplication, division

opCast
bool opCast()

FloatingPoint valueType, Returns true if all values are not nan and finite, otherwise false

opDispatch
auto opDispatch()

Implements swizzling.

opDispatch
void opDispatch(RHS rhs)

Support swizzling assignment like in shader languages.

opEquals
bool opEquals(T vec)

Comparisson Operator

opOpAssign
void opOpAssign(valueType val)

Op= Operation with a scalar

opOpAssign
void opOpAssign(Vector vec)

Componentwise Op= Operation with another vector

opUnary
Vector opUnary()

TODO : This does not work Negate the vector

ptr
auto ptr()

Returns a pointer to the coordinates

toString
char[] toString(char[] buffer)

Returns the current vector formatted as char[] slice of the passed in buffer excluding terminating \0. The terminator is still part of the buffer to be able to use write(ln) as well as printf using buffer.ptr

Static functions

isCompatibleVectorImpl
void isCompatibleVectorImpl(Vector!(vt, dim) vec)
Undocumented in source. Be warned that the author may not have intended to support it.

Templates

isCompatibleVector
template isCompatibleVector(T)
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Parameters

type

the value type of each vector element

dim

specifies the dimension of the vector, can be 1, 2, 3 or 4

Examples

alias Vector!(int, 3) vec3i;
alias Vector!(float, 4) vec4;
alias Vector!(real, 2) vec2r;

Meta