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

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

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

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

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

setSwizz
string setSwizz(int[] idx)

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

Variables

comp
enum string[dimension] comp;

Build swizzle setter and getter properties

data
type[dim] data;

Holds all coordinates, length conforms dimension

Examples

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

Meta