bettercmath.vector

Type and dimension generic Vector backed by a static array.

Members

Enums

isVector
eponymoustemplate isVector(T)

True if T is some kind of Vector

Functions

cross
Vector!(T, 3) cross(Vector!(T, 3) a, Vector!(T, 3) b)

Returns the cross product between two 3D Vectors.

dot
T dot(Vector!(T, N) a, Vector!(T, N) b)

Returns the dot product between two Vectors.

lerp (from bettercmath.misc)
T lerp(T[2] fromTo, U amount) via public import bettercmath.misc : lerp;

Linearly interpolates the values from fromTo by amount.

magnitude
auto magnitude(Vector!(T, N) vec)

Returns the magnitude (Euclidean length) of a Vector.

magnitudeSquared
T magnitudeSquared(Vector!(T, N) vec)

Returns the squared magnitude (Euclidean length) of a Vector.

map
Vector!(typeof(mapfunc(cast(T)0)), N) map(Vector!(T, N) vec)
Undocumented in source. Be warned that the author may not have intended to support it.
normalize
Vector!(T, N) normalize(Vector!(T, N) vec)

Normalize a Vector inplace.

normalized
Vector!(T, N) normalized(Vector!(T, N) vec)

Returns a normalized copy of Vector.

reflect
Vector!(T, N) reflect(Vector!(T, N) vec, Vector!(T, N) normal)

Returns a Vector that is the reflection of vec against normal.

vector
Vector!(T, N) vector(T[N] elements)

Construct Vector directly from static array, inferring element type.

Structs

Vector
struct Vector(T, uint N)

Generic Vector backed by a static array.

Meta