From 75b99ef87d34d07aa0d64058ea12387085369017 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Sat, 9 Dec 2023 21:28:53 +0300 Subject: [PATCH 1/2] fixes: https://github.com/recp/cglm/issues/371 --- include/cglm/mat2x3.h | 10 ++++------ include/cglm/mat2x4.h | 10 ++++------ include/cglm/mat3x2.h | 10 ++++------ include/cglm/mat3x4.h | 10 ++++------ include/cglm/mat4x2.h | 10 ++++------ include/cglm/mat4x3.h | 10 ++++------ include/cglm/struct/mat2.h | 4 ++-- include/cglm/struct/mat2x3.h | 10 ++++------ include/cglm/struct/mat2x4.h | 10 ++++------ include/cglm/struct/mat3.h | 4 ++-- include/cglm/struct/mat3x2.h | 10 ++++------ include/cglm/struct/mat3x4.h | 10 ++++------ include/cglm/struct/mat4.h | 4 ++-- include/cglm/struct/mat4x2.h | 10 ++++------ include/cglm/struct/mat4x3.h | 10 ++++------ 15 files changed, 54 insertions(+), 78 deletions(-) diff --git a/include/cglm/mat2x3.h b/include/cglm/mat2x3.h index e7ca209..f7a3930 100644 --- a/include/cglm/mat2x3.h +++ b/include/cglm/mat2x3.h @@ -81,15 +81,13 @@ glm_mat2x3_make(float * __restrict src, mat2x3 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat2x3_mul(m, m, m); + * glm_mat2x3_mul(mat2x3, mat3x2, mat2); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat2x3) + * @param[in] m2 right matrix (mat3x2) + * @param[out] dest destination matrix (mat2) */ CGLM_INLINE void diff --git a/include/cglm/mat2x4.h b/include/cglm/mat2x4.h index 28156cd..9ec8d9e 100644 --- a/include/cglm/mat2x4.h +++ b/include/cglm/mat2x4.h @@ -79,15 +79,13 @@ glm_mat2x4_make(float * __restrict src, mat2x4 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat2x4_mul(m, m, m); + * glm_mat2x4_mul(mat2x4, mat4x2, mat2); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat2x4) + * @param[in] m2 right matrix (mat4x2) + * @param[out] dest destination matrix (mat2) */ CGLM_INLINE void diff --git a/include/cglm/mat3x2.h b/include/cglm/mat3x2.h index f7c8a72..3b45a96 100644 --- a/include/cglm/mat3x2.h +++ b/include/cglm/mat3x2.h @@ -83,15 +83,13 @@ glm_mat3x2_make(float * __restrict src, mat3x2 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat3x2_mul(m, m, m); + * glm_mat3x2_mul(mat3x2, mat2x3, mat3); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat3x2) + * @param[in] m2 right matrix (mat2x3) + * @param[out] dest destination matrix (mat3) */ CGLM_INLINE void diff --git a/include/cglm/mat3x4.h b/include/cglm/mat3x4.h index 86fb938..24ed442 100644 --- a/include/cglm/mat3x4.h +++ b/include/cglm/mat3x4.h @@ -86,15 +86,13 @@ glm_mat3x4_make(float * __restrict src, mat3x4 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat3x4_mul(m, m, m); + * glm_mat3x4_mul(mat3x4, mat4x3, mat3); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat3x4) + * @param[in] m2 right matrix (mat4x3) + * @param[out] dest destination matrix (mat3) */ CGLM_INLINE void diff --git a/include/cglm/mat4x2.h b/include/cglm/mat4x2.h index 4c647a2..6842d7a 100644 --- a/include/cglm/mat4x2.h +++ b/include/cglm/mat4x2.h @@ -89,15 +89,13 @@ glm_mat4x2_make(float * __restrict src, mat4x2 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat4x2_mul(m, m, m); + * glm_mat4x2_mul(mat4x2, mat2x4, mat4); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat4x2) + * @param[in] m2 right matrix (mat2x4) + * @param[out] dest destination matrix (mat4) */ CGLM_INLINE void diff --git a/include/cglm/mat4x3.h b/include/cglm/mat4x3.h index 1066dfc..c120371 100644 --- a/include/cglm/mat4x3.h +++ b/include/cglm/mat4x3.h @@ -98,15 +98,13 @@ glm_mat4x3_make(float * __restrict src, mat4x3 dest) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat4x3_mul(m, m, m); + * glm_mat4x3_mul(mat4x3, mat3x4, mat4); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat4x3) + * @param[in] m2 right matrix (mat3x4) + * @param[out] dest destination matrix (mat4) */ CGLM_INLINE void diff --git a/include/cglm/struct/mat2.h b/include/cglm/struct/mat2.h index d1692a5..a1518e3 100644 --- a/include/cglm/struct/mat2.h +++ b/include/cglm/struct/mat2.h @@ -108,13 +108,13 @@ glms_mat2_(zero)(void) { * * @code * mat2 m = GLM_MAT2_IDENTITY_INIT; - * glm_mat2_mul(m, m, m); + * r = glms_mat2_mul(m, m); * @endcode * * @param[in] m1 left matrix * @param[in] m2 right matrix * - * @returns matrix + * @returns destination matrix */ CGLM_INLINE mat2s diff --git a/include/cglm/struct/mat2x3.h b/include/cglm/struct/mat2x3.h index d0aacb0..ec4ebfb 100644 --- a/include/cglm/struct/mat2x3.h +++ b/include/cglm/struct/mat2x3.h @@ -64,15 +64,13 @@ glms_mat2x3_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat2x3_mul(m, m, m); + * r = glms_mat2x3_mul(mat2x3s, mat3x2s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat2x3s) + * @param[in] m2 right matrix (mat3x2s) + * @returns destination matrix (mat2s) */ CGLM_INLINE mat2s diff --git a/include/cglm/struct/mat2x4.h b/include/cglm/struct/mat2x4.h index 4b31dd2..d882fc2 100644 --- a/include/cglm/struct/mat2x4.h +++ b/include/cglm/struct/mat2x4.h @@ -64,15 +64,13 @@ glms_mat2x4_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat2x4_mul(m, m, m); + * r = glms_mat2x4_mul(mat2x4s, mat4x2s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat2x4s) + * @param[in] m2 right matrix (mat4x2s) + * @returns destination matrix (mat2s) */ CGLM_INLINE mat2s diff --git a/include/cglm/struct/mat3.h b/include/cglm/struct/mat3.h index 6497acd..3064bfd 100644 --- a/include/cglm/struct/mat3.h +++ b/include/cglm/struct/mat3.h @@ -124,12 +124,12 @@ glms_mat3_(zero)(void) { * * @code * mat3 m = GLM_MAT3_IDENTITY_INIT; - * glm_mat3_mul(m, m, m); + * r = glms_mat3_mul(m, m); * @endcode * * @param[in] m1 left matrix * @param[in] m2 right matrix - * @returns destination matrix + * @returns destination matrix */ CGLM_INLINE mat3s diff --git a/include/cglm/struct/mat3x2.h b/include/cglm/struct/mat3x2.h index 7f3c134..c2329b3 100644 --- a/include/cglm/struct/mat3x2.h +++ b/include/cglm/struct/mat3x2.h @@ -64,15 +64,13 @@ glms_mat3x2_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat3x2_mul(m, m, m); + * r = glms_mat3x2_mul(mat3x2s, mat2x3s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat3x2s) + * @param[in] m2 right matrix (mat2x3s) + * @returns destination matrix (mat3s) */ CGLM_INLINE mat3s diff --git a/include/cglm/struct/mat3x4.h b/include/cglm/struct/mat3x4.h index c273b2d..2ad5499 100644 --- a/include/cglm/struct/mat3x4.h +++ b/include/cglm/struct/mat3x4.h @@ -64,15 +64,13 @@ glms_mat3x4_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat3x4_mul(m, m, m); + * r = glms_mat3x4_mul(mat3x4s, mat4x3s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat3x4s) + * @param[in] m2 right matrix (mat4x3s) + * @returns destination matrix (mat3s) */ CGLM_INLINE mat3s diff --git a/include/cglm/struct/mat4.h b/include/cglm/struct/mat4.h index 0e7760b..d6407b1 100644 --- a/include/cglm/struct/mat4.h +++ b/include/cglm/struct/mat4.h @@ -200,12 +200,12 @@ glms_mat4_(ins3)(mat3s mat, mat4s dest) { * * @code * mat4 m = GLM_MAT4_IDENTITY_INIT; - * glm_mat4_mul(m, m, m); + * r = glms_mat4_mul(m, m); * @endcode * * @param[in] m1 left matrix * @param[in] m2 right matrix - * @returns destination matrix + * @returns destination matrix */ CGLM_INLINE mat4s diff --git a/include/cglm/struct/mat4x2.h b/include/cglm/struct/mat4x2.h index 33449bb..17f5743 100644 --- a/include/cglm/struct/mat4x2.h +++ b/include/cglm/struct/mat4x2.h @@ -65,15 +65,13 @@ glms_mat4x2_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat4x2_mul(m, m, m); + * r = glms_mat4x2_mul(mat4x2s, mat2x4s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat4x2s) + * @param[in] m2 right matrix (mat2x4s) + * @returns destination matrix (mat4s) */ CGLM_INLINE mat4s diff --git a/include/cglm/struct/mat4x3.h b/include/cglm/struct/mat4x3.h index 30aea81..68e7c70 100644 --- a/include/cglm/struct/mat4x3.h +++ b/include/cglm/struct/mat4x3.h @@ -64,15 +64,13 @@ glms_mat4x3_(make)(float * __restrict src) { /*! * @brief multiply m1 and m2 to dest * - * m1, m2 and dest matrices can be same matrix, it is possible to write this: - * * @code - * glm_mat4x3_mul(m, m, m); + * r = glms_mat4x3_mul(mat4x3s, mat3x4s); * @endcode * - * @param[in] m1 left matrix - * @param[in] m2 right matrix - * @param[out] dest destination matrix + * @param[in] m1 left matrix (mat4x3s) + * @param[in] m2 right matrix (mat3x4s) + * @returns destination matrix (mat4s) */ CGLM_INLINE mat4s From 047138321ccf7c813d5b51c6787f5c7336a366d6 Mon Sep 17 00:00:00 2001 From: Vincent Davis Jr Date: Sat, 9 Dec 2023 14:23:19 -0500 Subject: [PATCH 2/2] docs: 2/2 fixes https://github.com/recp/cglm/issues/371 Second commit for fixing non-square matrix multiplication docs. Signed-off-by: Vincent Davis Jr --- docs/source/mat2x3.rst | 10 ++++------ docs/source/mat2x4.rst | 10 ++++------ docs/source/mat3x2.rst | 10 ++++------ docs/source/mat3x4.rst | 10 ++++------ docs/source/mat4x2.rst | 10 ++++------ docs/source/mat4x3.rst | 10 ++++------ 6 files changed, 24 insertions(+), 36 deletions(-) diff --git a/docs/source/mat2x3.rst b/docs/source/mat2x3.rst index 99ab6d5..84828c8 100644 --- a/docs/source/mat2x3.rst +++ b/docs/source/mat2x3.rst @@ -55,16 +55,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat2x3_mul(m, m, m); + glm_mat2x3_mul(mat2x3, mat3x2, mat2); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat2x3) + | *[in]* **m2** right matrix (mat3x2) + | *[out]* **dest** destination matrix (mat2) .. c:function:: void glm_mat2x3_mulv(mat2x3 m, vec3 v, vec2 dest) diff --git a/docs/source/mat2x4.rst b/docs/source/mat2x4.rst index efb79de..0311084 100644 --- a/docs/source/mat2x4.rst +++ b/docs/source/mat2x4.rst @@ -55,16 +55,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat2x4_mul(m, m, m); + glm_mat2x4_mul(mat2x4, mat4x2, mat2); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat2x4) + | *[in]* **m2** right matrix (mat4x2) + | *[out]* **dest** destination matrix (mat2) .. c:function:: void glm_mat2x4_mulv(mat2x4 m, vec4 v, vec2 dest) diff --git a/docs/source/mat3x2.rst b/docs/source/mat3x2.rst index 0a9cb87..c3e2c21 100644 --- a/docs/source/mat3x2.rst +++ b/docs/source/mat3x2.rst @@ -54,16 +54,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat3x2_mul(m, m, m); + glm_mat3x2_mul(mat3x2, mat2x3, mat3); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat3x2) + | *[in]* **m2** right matrix (mat2x3) + | *[out]* **dest** destination matrix (mat3) .. c:function:: void glm_mat3x2_mulv(mat3x2 m, vec2 v, vec3 dest) diff --git a/docs/source/mat3x4.rst b/docs/source/mat3x4.rst index 8afaff0..042c030 100644 --- a/docs/source/mat3x4.rst +++ b/docs/source/mat3x4.rst @@ -54,16 +54,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat3x4_mul(m, m, m); + glm_mat3x4_mul(mat3x4, mat4x3, mat3); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat3x4) + | *[in]* **m2** right matrix (mat4x3) + | *[out]* **dest** destination matrix (mat3) .. c:function:: void glm_mat3x4_mulv(mat3x4 m, vec4 v, vec3 dest) diff --git a/docs/source/mat4x2.rst b/docs/source/mat4x2.rst index ccda3ac..f4c71d2 100644 --- a/docs/source/mat4x2.rst +++ b/docs/source/mat4x2.rst @@ -54,16 +54,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat4x2_mul(m, m, m); + glm_mat4x2_mul(mat4x2, mat2x4, mat4); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat4x2) + | *[in]* **m2** right matrix (mat2x4) + | *[out]* **dest** destination matrix (mat4) .. c:function:: void glm_mat4x2_mulv(mat4x2 m, vec2 v, vec4 dest) diff --git a/docs/source/mat4x3.rst b/docs/source/mat4x3.rst index 7284045..84c9196 100644 --- a/docs/source/mat4x3.rst +++ b/docs/source/mat4x3.rst @@ -54,16 +54,14 @@ Functions documentation multiply m1 and m2 to dest - m1, m2 and dest matrices can be same matrix, it is possible to write this: - .. code-block:: c - glm_mat4x3_mul(m, m, m); + glm_mat4x3_mul(mat4x3, mat3x4, mat4); Parameters: - | *[in]* **m1** left matrix - | *[in]* **m2** right matrix - | *[out]* **dest** destination matrix + | *[in]* **m1** left matrix (mat4x3) + | *[in]* **m2** right matrix (mat3x4) + | *[out]* **dest** destination matrix (mat4) .. c:function:: void glm_mat4x3_mulv(mat4x3 m, vec3 v, vec4 dest)