mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
add documentation to util header
This commit is contained in:
@@ -31,36 +31,68 @@ glm_sign(int val) {
|
|||||||
return ((val >> 31) - (-val >> 31));
|
return ((val >> 31) - (-val >> 31));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief convert degree to radians
|
||||||
|
*
|
||||||
|
* @param[in] deg angle in degrees
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
float
|
float
|
||||||
glm_rad(float deg) {
|
glm_rad(float deg) {
|
||||||
return deg * CGLM_PI / 180.0f;
|
return deg * CGLM_PI / 180.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief convert radians to degree
|
||||||
|
*
|
||||||
|
* @param[in] deg angle in radians
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
float
|
float
|
||||||
glm_deg(float rad) {
|
glm_deg(float rad) {
|
||||||
return rad * 180.0f / CGLM_PI;
|
return rad * 180.0f / CGLM_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief convert exsisting degree to radians. this will override degrees value
|
||||||
|
*
|
||||||
|
* @param[in, out] deg pointer to angle in degrees
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_make_rad(float *deg) {
|
glm_make_rad(float *deg) {
|
||||||
*deg = *deg * CGLM_PI / 180.0f;
|
*deg = *deg * CGLM_PI / 180.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief convert exsisting radians to degree. this will override radians value
|
||||||
|
*
|
||||||
|
* @param[in, out] rad pointer to angle in radians
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_make_deg(float *rad) {
|
glm_make_deg(float *rad) {
|
||||||
*rad = *rad * 180.0f / CGLM_PI;
|
*rad = *rad * 180.0f / CGLM_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief multiplies given parameter with itself = x * x or powf(x, 2)
|
||||||
|
*
|
||||||
|
* @param[in] x x
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
float
|
float
|
||||||
glm_pow2(float x) {
|
glm_pow2(float x) {
|
||||||
|
|
||||||
return x * x;
|
return x * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief find minimum of given two values
|
||||||
|
*
|
||||||
|
* @param[in] a number 1
|
||||||
|
* @param[in] b number 2
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
float
|
float
|
||||||
glm_min(float a, float b) {
|
glm_min(float a, float b) {
|
||||||
@@ -69,6 +101,12 @@ glm_min(float a, float b) {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief find maximum of given two values
|
||||||
|
*
|
||||||
|
* @param[in] a number 1
|
||||||
|
* @param[in] b number 2
|
||||||
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
float
|
float
|
||||||
glm_max(float a, float b) {
|
glm_max(float a, float b) {
|
||||||
|
|||||||
Reference in New Issue
Block a user