// Common functions for vectors. // // This header file contains functions that operate with different kinds of // vectors that would result in circular dependencies if defined in any of the // vec2/3/4 header files. #pragma once #include "vec2.h" #include "vec3.h" #include "vec4.h" /// Construct a 3D vector from a 2D one with z = 0. static inline vec3 vec3_from_vec2(vec2 v) { return vec3{v.x, v.y, 0, 0}; } /// Project a 4D vector onto w=0. static inline vec3 vec3_from_vec4(vec4 v) { return vec3{v.x, v.y, v.z, 0}; }