mat3.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. .. default-domain:: C
  2. mat3
  3. ====
  4. Header: cglm/mat3.h
  5. Table of contents (click to go):
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. Macros:
  8. 1. GLM_MAT3_IDENTITY_INIT
  9. #. GLM_MAT3_ZERO_INIT
  10. #. GLM_MAT3_IDENTITY
  11. #. GLM_MAT3_ZERO
  12. #. glm_mat3_dup(mat, dest)
  13. Functions:
  14. 1. :c:func:`glm_mat3_copy`
  15. #. :c:func:`glm_mat3_identity`
  16. #. :c:func:`glm_mat3_identity_array`
  17. #. :c:func:`glm_mat3_zero`
  18. #. :c:func:`glm_mat3_mul`
  19. #. :c:func:`glm_mat3_transpose_to`
  20. #. :c:func:`glm_mat3_transpose`
  21. #. :c:func:`glm_mat3_mulv`
  22. #. :c:func:`glm_mat3_quat`
  23. #. :c:func:`glm_mat3_scale`
  24. #. :c:func:`glm_mat3_det`
  25. #. :c:func:`glm_mat3_inv`
  26. #. :c:func:`glm_mat3_trace`
  27. #. :c:func:`glm_mat3_swap_col`
  28. #. :c:func:`glm_mat3_swap_row`
  29. #. :c:func:`glm_mat3_rmc`
  30. Functions documentation
  31. ~~~~~~~~~~~~~~~~~~~~~~~
  32. .. c:function:: void glm_mat3_copy(mat3 mat, mat3 dest)
  33. copy mat3 to another one (dest).
  34. Parameters:
  35. | *[in]* **mat** source
  36. | *[out]* **dest** destination
  37. .. c:function:: void glm_mat3_identity(mat3 mat)
  38. copy identity mat3 to mat, or makes mat to identiy
  39. Parameters:
  40. | *[out]* **mat** matrix
  41. .. c:function:: void glm_mat3_identity_array(mat3 * __restrict mat, size_t count)
  42. make given matrix array's each element identity matrix
  43. Parameters:
  44. | *[in,out]* **mat** matrix array (must be aligned (16/32) if alignment is not disabled)
  45. | *[in]* **count** count of matrices
  46. .. c:function:: void glm_mat3_zero(mat3 mat)
  47. make given matrix zero
  48. Parameters:
  49. | *[in,out]* **mat** matrix to
  50. .. c:function:: void glm_mat3_mul(mat3 m1, mat3 m2, mat3 dest)
  51. multiply m1 and m2 to dest
  52. m1, m2 and dest matrices can be same matrix, it is possible to write this:
  53. .. code-block:: c
  54. mat3 m = GLM_MAT3_IDENTITY_INIT;
  55. glm_mat3_mul(m, m, m);
  56. Parameters:
  57. | *[in]* **m1** left matrix
  58. | *[in]* **m2** right matrix
  59. | *[out]* **dest** destination matrix
  60. .. c:function:: void glm_mat3_transpose_to(mat3 m, mat3 dest)
  61. transpose mat4 and store in dest
  62. source matrix will not be transposed unless dest is m
  63. Parameters:
  64. | *[in]* **mat** source
  65. | *[out]* **dest** destination
  66. .. c:function:: void glm_mat3_transpose(mat3 m)
  67. tranpose mat3 and store result in same matrix
  68. Parameters:
  69. | *[in]* **mat** source
  70. | *[out]* **dest** destination
  71. .. c:function:: void glm_mat3_mulv(mat3 m, vec3 v, vec3 dest)
  72. multiply mat4 with vec4 (column vector) and store in dest vector
  73. Parameters:
  74. | *[in]* **mat** mat3 (left)
  75. | *[in]* **v** vec3 (right, column vector)
  76. | *[out]* **dest** destination (result, column vector)
  77. .. c:function:: void glm_mat3_quat(mat3 m, versor dest)
  78. convert mat3 to quaternion
  79. Parameters:
  80. | *[in]* **m** rotation matrix
  81. | *[out]* **dest** destination quaternion
  82. .. c:function:: void glm_mat3_scale(mat3 m, float s)
  83. multiply matrix with scalar
  84. Parameters:
  85. | *[in, out]* **mat** matrix
  86. | *[in]* **dest** scalar
  87. .. c:function:: float glm_mat3_det(mat3 mat)
  88. returns mat3 determinant
  89. Parameters:
  90. | *[in]* **mat** matrix
  91. Returns:
  92. mat3 determinant
  93. .. c:function:: void glm_mat3_inv(mat3 mat, mat3 dest)
  94. inverse mat3 and store in dest
  95. Parameters:
  96. | *[in]* **mat** matrix
  97. | *[out]* **dest** destination (inverse matrix)
  98. .. c:function:: void glm_mat3_trace(mat3 m)
  99. | sum of the elements on the main diagonal from upper left to the lower right
  100. Parameters:
  101. | *[in]* **m** matrix
  102. Returns:
  103. trace of matrix
  104. .. c:function:: void glm_mat3_swap_col(mat3 mat, int col1, int col2)
  105. swap two matrix columns
  106. Parameters:
  107. | *[in, out]* **mat** matrix
  108. | *[in]* **col1** col1
  109. | *[in]* **col2** col2
  110. .. c:function:: void glm_mat3_swap_row(mat3 mat, int row1, int row2)
  111. swap two matrix rows
  112. Parameters:
  113. | *[in, out]* **mat** matrix
  114. | *[in]* **row1** row1
  115. | *[in]* **row2** row2
  116. .. c:function:: float glm_mat3_rmc(vec3 r, mat3 m, vec3 c)
  117. | **rmc** stands for **Row** * **Matrix** * **Column**
  118. | helper for R (row vector) * M (matrix) * C (column vector)
  119. | the result is scalar because R * M = Matrix1x3 (row vector),
  120. | then Matrix1x3 * Vec3 (column vector) = Matrix1x1 (Scalar)
  121. Parameters:
  122. | *[in]* **r** row vector or matrix1x3
  123. | *[in]* **m** matrix3x3
  124. | *[in]* **c** column vector or matrix3x1
  125. Returns:
  126. scalar value e.g. Matrix1x1