bettercmath.vector

Type and dimension generic Vector backed by a static array.

Public Imports

bettercmath.misc
public import bettercmath.misc : lerp;

lerp function for UFCS

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.

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.

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.

vector
Vector!(CommonType!Args, Args.length) vector(Args args)

Construct Vector directly from elements, inferring element type.

Structs

Vector
struct Vector(T, uint N)

Generic Vector backed by a static array.

Meta