// 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;
A 'homogeneous vector': A vector with the last element set to 1 by default.