Vector

A vector is an object representing distance in vertical and horizontal directions in multidimensional space Components are the first template parameter with the second template parameter being vector dimensionality Most vector operations take advantage of parallelism to do simple arithmetic on each component in parallel TODO: slices returning vectors, swizzling, and dispatch forwarding

Constructors

this
this(T[] components...)

A vector constructor; takes in the number of args given and assigns them as components

this
this(T allComponents)

A vector constructor; takes in a value that acts as both vector components

this
this()

A constructor that sets all elements to 0

this
this(Vector!(T, dimensions) toCopy)

A copy constructor for a vector; makes the same vector, but as a different instance

Members

Functions

apply
void apply(void delegate(T) application)

Applies the given function to each element of the vector

apply
Vector!(U, dimensions) apply(U delegate(T) application)

Applies the given function to each element of the vector and returns the results in a new vector

opAssign
void opAssign(T[] rhs)

Allows assigning the vector to a static array to set all components of the vector

opAssign
void opAssign(T rhs)

Allows assigning the vector to a single value to set all elements of the vector to such a value

opBinary
Vector!(T, dimensions) opBinary(Vector!(T, dimensions) otherVector)

Allows the vector to be used with normal operators Works component-wise (eg. (3, 2, 1) + (1, 2, 3) = (4, 4, 4))

opBinary
Vector!(T, dimensions) opBinary(T[] otherComponents)

Allows the vector to be used with normal operators Works component-wise (eg. (3, 2, 1) + (1, 2, 3) = (4, 4, 4))

opBinary
Vector!(T, dimensions) opBinary(T constant)

Allows the vector to be used with normal operators Works component-wise, so each operation of the constant is applied to each component

opCast
U opCast()

Casts the vector to a vector of another type

opEquals
bool opEquals(Object o)

Returns whether the vector is equal to another vector or constant Uses approxEquals to do easy equality for vectors of doubles

opOpAssign
void opOpAssign(Vector!(T, dimensions) otherVector)

Allows the vector to have the joint operator assign syntax Works component-wise (eg. (3, 2, 1) += (1, 2, 3) makes (3, 2, 1) into (4, 4, 4))

opOpAssign
void opOpAssign(T[] otherComponents)

Allows the vector to have the joint operator assign syntax Works component-wise, so each operation of the constant is applied to each component

opOpAssign
void opOpAssign(T constant)

Allows the vector to have the joint operator assign syntax Works component-wise, so each operation of the constant is applied to each component

opUnary
Vector!(T, dimensions) opUnary()

Allows unary functions to be applied to the vector; aplies the same operator to all components

toString
string toString()

Gives the vector a pretty string format (eg. (1, 2, 3) => <1, 2, 3>)

Properties

directionAngles
Vector!(double, dimensions) directionAngles [@property setter]

Sets the angles of the vector where the angles are given in radians Angles are direction angles (eg. first angle is direction from x, second is direction from y, etc...) 0 goes along the positive axis

directionAngles
Vector!(double, dimensions) directionAngles [@property getter]

Gets the angles of the vector where the angles are given in radians Angles are direction angles (eg. first angle is direction from x, second is direction from y, etc...) 0 goes along the positive axis

magnitude
double magnitude [@property setter]

Sets the length of the vector Maintains component ratios of the vector

magnitude
double magnitude [@property getter]

Gets the length of the vector

Unions

__anonymous
union __anonymous

The components of the vector

Meta