mat2x3: add tables to docs & fix comments

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
Vincent Davis Jr
2025-04-02 15:15:38 -04:00
parent f3094cdc65
commit 43363e8c43
5 changed files with 194 additions and 138 deletions

View File

@@ -36,58 +36,103 @@ Represented
Functions documentation
~~~~~~~~~~~~~~~~~~~~~~~
.. c:function:: void glm_mat2x3_copy(mat2x3 mat, mat2x3 dest)
.. c:function:: void glm_mat2x3_copy(mat2x3 src, mat2x3 dest)
copy mat2x3 to another one (dest).
Copy mat2x3 (src) to mat2x3 (dest).
Parameters:
| *[in]* **mat** source
| *[out]* **dest** destination
| *[in]* **src** mat2x3 (left)
| *[out]* **dest** destination (result, mat2x3)
.. c:function:: void glm_mat2x3_zero(mat2x3 mat)
make given matrix zero
Parameters:
| *[in,out]* **mat** matrix
.. c:function:: void glm_mat2x3_make(const float * __restrict src, mat2x3 dest)
Create mat2x3 matrix from pointer
.. note:: **@src** must contain at least 6 elements.
Parameters:
| *[in]* **src** pointer to an array of floats
| *[out]* **dest** destination matrix2x3
.. c:function:: void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest)
multiply m1 and m2 to dest
.. code-block:: c
glm_mat2x3_mul(mat2x3, mat3x2, mat3);
Parameters:
| *[in]* **m1** left matrix (mat2x3)
| *[in]* **m2** right matrix (mat3x2)
| *[out]* **dest** destination matrix (mat3)
.. csv-table:: mat2x3
.. csv-table:: mat2x3 **(src)**
:header: "", "column 1", "column 2"
"row 1", "a00", "a10"
"row 2", "a01", "a11"
"row 3", "a02", "a12"
.. csv-table:: mat3x2
.. csv-table:: mat2x3 **(dest)**
:header: "", "column 1", "column 2"
"row 1", "b00 = a00", "b10 = a10"
"row 2", "b01 = a01", "b11 = a11"
"row 3", "b02 = a02", "b12 = a12"
.. c:function:: void glm_mat2x3_zero(mat2x3 m)
Zero out the mat2x3 (m).
Parameters:
| *[in, out]* **mat** mat2x3 (src, dest)
.. csv-table:: mat2x3 **(m)**
:header: "", "column 1", "column 2"
"row 1", "0.00", "2.00"
"row 2", "5.00", "4.00"
"row 3", "7.00", "6.00"
.. csv-table:: mat2x3 **(m)**
:header: "", "column 1", "column 2"
"row 1", "0.00", "0.00"
"row 2", "0.00", "0.00"
"row 3", "0.00", "0.00"
.. c:function:: void glm_mat2x3_make(const float * __restrict src, mat2x3 dest)
Create mat2x3 (dest) from pointer (src).
.. note:: **@src** must contain at least 6 elements.
Parameters:
| *[in]* **src** pointer to an array of floats (left)
| *[out]* **dest** destination (result, mat2x3)
.. csv-table:: float array (1x6) **(src)**
:header: "", "column 1"
"row 1", "v0"
"row 2", "v1"
"row 3", "v2"
"row 4", "v3"
"row 5", "v4"
"row 6", "v5"
.. csv-table:: mat2x3 **(dest)**
:header: "", "column 1", "column 2"
"row 1", "v0", "v3"
"row 2", "v1", "v4"
"row 3", "v2", "v5"
.. c:function:: void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest)
Multiply mat2x3 (m1) by mat3x2 (m2) and store in mat3 (dest).
.. code-block:: c
glm_mat2x3_mul(mat2x3, mat3x2, mat3);
Parameters:
| *[in]* **m1** mat2x3 (left)
| *[in]* **m2** mat3x2 (right)
| *[out]* **dest** destination (result, mat3)
.. csv-table:: mat2x3 **(m1)**
:header: "", "column 1", "column 2"
"row 1", "a00", "a10"
"row 2", "a01", "a11"
"row 3", "a02", "a12"
.. csv-table:: mat3x2 **(m2)**
:header: "", "column 1", "column 2", "column 3"
"row 1", "b00", "b10", "b20"
"row 2", "b01", "b11", "b21"
.. csv-table:: mat3x3
.. csv-table:: mat3 **(dest)**
:header: "", "column 1", "column 2", "column 3"
"row 1", "a00 * b00 + a10 * b01", "a00 * b10 + a10 * b11", "a00 * b20 + a10 * b21"
@@ -96,45 +141,65 @@ Functions documentation
.. c:function:: void glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest)
multiply mat2x3 with vec2 (column vector) and store in dest column vector
Multiply mat2x3 (m) by vec2 (v) and store in vec3 (dest).
Parameters:
| *[in]* **m** mat2x3 (left)
| *[in]* **v** vec3 (right, column vector)
| *[out]* **dest** destination (result, column vector)
| *[in]* **m** mat2x3 (left)
| *[in]* **v** vec2 (right, column vector)
| *[out]* **dest** destination (result, column vector)
.. csv-table:: mat2x3
.. csv-table:: mat2x3 **(m)**
:header: "", "column 1", "column 2"
"row 1", "m00", "m10"
"row 2", "m01", "m11"
"row 3", "m02", "m12"
.. csv-table:: column vec2 (1x2)
.. csv-table:: column vec2 (1x2) **(v)**
:header: "", "column 1"
"row 1", "v0"
"row 2", "v1"
.. csv-table:: column vec3 (1x3)
.. csv-table:: column vec3 (1x3) **(dest)**
:header: "", "column 1"
"row 1", "m00 * v0 + m10 * v1"
"row 2", "m01 * v0 + m11 * v1"
"row 3", "m02 * v0 + m12 * v1"
.. c:function:: void glm_mat2x3_transpose(mat2x3 m, mat3x2 dest)
.. c:function:: void glm_mat2x3_transpose(mat2x3 src, mat3x2 dest)
transpose matrix and store in dest
Transpose mat2x3 (src) and store in mat3x2 (dest).
Parameters:
| *[in]* **m** matrix
| *[out]* **dest** destination
| *[in]* **src** mat2x3 (left)
| *[out]* **dest** destination (result, mat3x2)
.. c:function:: void glm_mat2x3_scale(mat2x3 m, float s)
.. csv-table:: mat2x3 **(src)**
:header: "", "column 1", "column 2"
multiply matrix with scalar
"row 1", "a00", "a10"
"row 2", "a01", "a11"
"row 3", "a02", "a12"
.. csv-table:: mat3x2 **(dest)**
:header: "", "column 1", "column 2", "column 3"
"row 1", "b00 = a00", "b10 = a01", "b20 = a02"
"row 2", "b01 = a10", "b11 = a11", "b21 = a12"
.. c:function:: void glm_mat2x3_scale(mat2x3 m, float s)
Multiply mat2x3 (m) by scalar constant (s).
Parameters:
| *[in, out]* **m** matrix
| *[in]* **s** scalar
| *[in, out]* **m** mat2x3 (src, dest)
| *[in]* **s** float (scalar)
.. csv-table:: mat2x3 **(m)**
:header: "", "column 1", "column 2"
"row 1", "m00 = m00 * s", "m10 = m10 * s"
"row 2", "m01 = m01 * s", "m11 = m11 * s"
"row 3", "m02 = m02 * s", "m12 = m12 * s"