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

Alias This

data

Members

Aliases

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

Functions

clear
void clear(valueType value)

Sets all values of the vector to value

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

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

Properties

asString
string asString [@property getter]

Returns the current vector formatted as string, useful for printing the vector

length
auto length [@property getter]

Returns the euclidean length of the vector

ok
bool ok [@property getter]

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

ptr
auto ptr [@property getter]

Returns a pointer to the coordinates.

Static functions

genSetSwizz
string genSetSwizz(int[] idx)

generates one swizzle setter property for a given permutation

getSwizz
string getSwizz(string component, string alias1, string alias2, string r, int term)

Generates all possible swizzle getter properties, creates also property aliases e.g. rgba

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

generates all possible swizzle setter properties for the default permutation ( e.g. [0,1,2,3] )

Templates

isCompatibleVector
template isCompatibleVector(T)
Undocumented in source.

Variables

aCol
enum string[dimension] aCol;
Undocumented in source.
aTex
enum string[dimension] aTex;
Undocumented in source.
comp
enum string[dimension] comp;
Undocumented in source.
data
type[dim] data;

Holds all coordinates, length conforms dimension

fill
enum string[dimension] fill;
Undocumented in source.
idcs
enum int[dimension] idcs;
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