Vector.this

Constructs Vector from components. If no components present vector will be filled with 0

  1. this(T val)
    struct Vector(T, size_t N)
    this
    (
    in T val
    )
    if (
    isNumeric!T &&
    N > 0
    )
  2. this(T[N] vals)
  3. this(T[4] vals)

Examples

// Vector can be constructed manually or with aliases
auto v2 = ivec2(10, 20);
// Also vector can be given only one value,
// in that case it'll be filled with that value
auto v5 = ivec4(13);
auto v6 = vec4(0.3f);
// Vector values can be accessed with array slicing,
// by using color symbols or swizzling
float v6x = v6.x;
float v6z = v6.z;
float[] v6yzx = v6.yzx;
float v6y = v6[1];
// Valid vector accessors are:
// Vector2 - [x, y], [w, h], [u, v]
// Vector3 - [x, y, z], [w, h, d], [u, v, t], [r, g, b]
// Vector4 - [x, y, z, w], [r, g, b, a]
// Other sizes must be accessed with index

Meta