new abs functions for vec2, ivec2, ivec3, ivec4

This commit is contained in:
duarm
2022-11-18 14:28:39 -03:00
parent 8cfc98d283
commit a0f01c5ed1
17 changed files with 177 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ FUNCTIONS:
CGLM_INLINE void glm_ivec2_maxv(ivec2 a, ivec2 b, ivec2 dest)
CGLM_INLINE void glm_ivec2_minv(ivec2 a, ivec2 b, ivec2 dest)
CGLM_INLINE void glm_ivec2_clamp(ivec2 v, int minVal, int maxVal)
CGLM_INLINE void glm_ivec2_abs(ivec2 v, ivec2 dest)
*/
#ifndef cglm_ivec2_h
@@ -239,4 +240,17 @@ glm_ivec2_clamp(ivec2 v, int minVal, int maxVal) {
v[1] = maxVal;
}
/*!
* @brief absolute value of v
*
* @param[in] v vector
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_ivec2_abs(ivec2 v, ivec2 dest) {
dest[0] = abs(v[0]);
dest[1] = abs(v[1]);
}
#endif /* cglm_ivec2_h */