HVector

A 'homogeneous vector': A vector with the last element set to 1 by default.

Constructors

this
this(const(T)[N2] v)
Undocumented in source.
this
this(Matrix!(T2, N2, 1) v)
Undocumented in source.

Alias This

vector

Members

Functions

length
void length()
Undocumented in source.
normalize
void normalize()
Undocumented in source.
normalized
void normalized()
Undocumented in source.
opAssign
HVector opAssign(const(T)[N2] v)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
HVector opAssign(Matrix!(T2, N2, 1) v)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

vector
Vector!(T, N) vector;
Undocumented in source.

Examples

// A HVector is a Vector with the last element set to 1 by default.
// This is handy for 4D representations of positions in 3D graphics
// and RGBA color vectors.
auto h = HVector4d(1, 0.3, 0.4);
assert(h[] == [1, 0.3, 0.4, 1]);
h = [0, 2, 3];
assert(h[] == [0, 2, 3, 1]);

// They can be converted back and forth to normal vectors.
Vector4d v = h;
HVector4d h1 = w;
HVector4d h2 = Vector3d(1, 2, 3);
h = v;
v = h;
h += v;

Meta