mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
mat4: helper for row * matrix * column
This commit is contained in:
@@ -45,6 +45,7 @@ Functions:
|
|||||||
#. :c:func:`glm_mat4_inv_fast`
|
#. :c:func:`glm_mat4_inv_fast`
|
||||||
#. :c:func:`glm_mat4_swap_col`
|
#. :c:func:`glm_mat4_swap_col`
|
||||||
#. :c:func:`glm_mat4_swap_row`
|
#. :c:func:`glm_mat4_swap_row`
|
||||||
|
#. :c:func:`glm_mat4_rmc`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -270,3 +271,20 @@ Functions documentation
|
|||||||
| *[in, out]* **mat** matrix
|
| *[in, out]* **mat** matrix
|
||||||
| *[in]* **row1** row1
|
| *[in]* **row1** row1
|
||||||
| *[in]* **row2** row2
|
| *[in]* **row2** row2
|
||||||
|
|
||||||
|
.. c:function:: float glm_mat4_rmc(vec4 r, mat4 m, vec4 c)
|
||||||
|
|
||||||
|
| **rmc** stands for **Row** * **Matrix** * **Column**
|
||||||
|
|
||||||
|
| helper for R (row vector) * M (matrix) * C (column vector)
|
||||||
|
|
||||||
|
| the result is scalar because S * M = Matrix1x4 (row vector),
|
||||||
|
| then Matrix1x4 * Vec4 (column vector) = Matrix1x1 (Scalar)
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **r** row vector or matrix1x4
|
||||||
|
| *[in]* **m** matrix4x4
|
||||||
|
| *[in]* **c** column vector or matrix4x1
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
scalar value e.g. Matrix1x1
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec4_minv`
|
#. :c:func:`glm_vec4_minv`
|
||||||
#. :c:func:`glm_vec4_clamp`
|
#. :c:func:`glm_vec4_clamp`
|
||||||
#. :c:func:`glm_vec4_lerp`
|
#. :c:func:`glm_vec4_lerp`
|
||||||
#. :c:func:`glm_vec4_isnan`
|
#. :c:func:`glm_vec4_cubic`
|
||||||
#. :c:func:`glm_vec4_isinf`
|
|
||||||
#. :c:func:`glm_vec4_isvalid`
|
|
||||||
#. :c:func:`glm_vec4_sign`
|
|
||||||
#. :c:func:`glm_vec4_sqrt`
|
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -401,3 +397,11 @@ Functions documentation
|
|||||||
| *[in]* **to** to value
|
| *[in]* **to** to value
|
||||||
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec4_cubic(float s, vec4 dest)
|
||||||
|
|
||||||
|
helper to fill vec4 as [S^3, S^2, S, 1]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **s** parameter
|
||||||
|
| *[out]* **dest** destination
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_mat4_swap_row(mat4 mat, int row1, int row2);
|
glmc_mat4_swap_row(mat4 mat, int row1, int row2);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
float
|
||||||
|
glmc_mat4_rmc(vec4 r, mat4 m, vec4 c);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -677,4 +677,26 @@ glm_mat4_swap_row(mat4 mat, int row1, int row2) {
|
|||||||
mat[3][row2] = tmp[3];
|
mat[3][row2] = tmp[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief helper for R (row vector) * M (matrix) * C (column vector)
|
||||||
|
*
|
||||||
|
* rmc stands for Row * Matrix * Column
|
||||||
|
*
|
||||||
|
* the result is scalar because S * M = Matrix1x4 (row vector),
|
||||||
|
* then Matrix1x4 * Vec4 (column vector) = Matrix1x1 (Scalar)
|
||||||
|
*
|
||||||
|
* @param[in] r row vector or matrix1x4
|
||||||
|
* @param[in] m matrix4x4
|
||||||
|
* @param[in] c column vector or matrix4x1
|
||||||
|
*
|
||||||
|
* @return scalar value e.g. B(s)
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
float
|
||||||
|
glm_mat4_rmc(vec4 r, mat4 m, vec4 c) {
|
||||||
|
vec4 tmp;
|
||||||
|
glm_mat4_mulv(m, r, tmp);
|
||||||
|
return glm_vec4_dot(c, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_mat_h */
|
#endif /* cglm_mat_h */
|
||||||
|
|||||||
@@ -151,3 +151,9 @@ void
|
|||||||
glmc_mat4_swap_row(mat4 mat, int row1, int row2) {
|
glmc_mat4_swap_row(mat4 mat, int row1, int row2) {
|
||||||
glm_mat4_swap_row(mat, row1, row2);
|
glm_mat4_swap_row(mat, row1, row2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
float
|
||||||
|
glmc_mat4_rmc(vec4 r, mat4 m, vec4 c) {
|
||||||
|
return glm_mat4_rmc(r, m, c);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user