URL: https://graphicscomputing.fr/cgp/reference/vec4/
Description: 4D vector of floats (homogeneous coordinates, RGBA).

# vec4

C++ type: `numarray_stack<float,4>`.
4D vector of floats (homogeneous coordinates, RGBA).

Fields:

- `T x` - First coordinate of the vector.
- `T y` - Second coordinate of the vector.
- `T z` - Third coordinate of the vector.
- `T w` - Fourth coordinate of the vector.

Functions taking it:

- `void check_index_bounds(INDEX_TYPE index, numarray_stack<T,4> const& data)` - Raises an error if the index is outside [0, 3]; no-op when CGP_NO_DEBUG is defined.
- `T const& get(numarray_stack<T,4> const& data)` - Component idx with the index checked at compile time (static_assert).
- `std::string type_str(numarray_stack<T,4> const&)` - Type name as a string, e.g. "numarray_stack4<int>".
- `std::string type_str(vec4 const&)` - Type name as a string: "vec4".
- `mat4 tensor_product(vec4 const& a, vec4 const& b)` - Outer product a * transpose(b), as a 4x4 matrix.
- `void opengl_uniform(opengl_shader_structure const& shader, std::string const& name, vec4 const& value, bool expected = true)` - Send a vec4 uniform to the shader; warns if the uniform is not found and expected is true.

Functions returning it:

- `numarray_stack<T,N2> const& get(matrix_stack<T,N1,N2> const& data)` - Row idx1 as a vector, with the index checked at compile time (static_assert).

Operators:

- `vec4 operator*(affine const& T, vec4 const& p)` - Apply the affine transform to a homogeneous vector, the translation being weighted by w: a direction (w=0) is not translated.
- `vec4 operator*(affine_rt const& T, vec4 const& p)` - Apply the rigid transform to a homogeneous vector, the translation being weighted by w.
- `vec4 operator*(affine_rts const& T, vec4 const& p)` - Apply the transform to a homogeneous vector, the translation being weighted by w.
- `vec4 operator*(rotation_transform const& r, vec4 const& p)` - Homogeneous vector whose xyz part is rotated, w being kept.
