mat3.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. #. :c:func:`glm_mat3_make`
  31. Functions documentation
  32. ~~~~~~~~~~~~~~~~~~~~~~~
  33. .. c:function:: void glm_mat3_copy(mat3 mat, mat3 dest)
  34. copy mat3 to another one (dest).
  35. Parameters:
  36. | *[in]* **mat** source
  37. | *[out]* **dest** destination
  38. .. c:function:: void glm_mat3_identity(mat3 mat)
  39. copy identity mat3 to mat, or makes mat to identiy
  40. Parameters:
  41. | *[out]* **mat** matrix
  42. .. c:function:: void glm_mat3_identity_array(mat3 * __restrict mat, size_t count)
  43. make given matrix array's each element identity matrix
  44. Parameters:
  45. | *[in,out]* **mat** matrix array (must be aligned (16/32) if alignment is not disabled)
  46. | *[in]* **count** count of matrices
  47. .. c:function:: void glm_mat3_zero(mat3 mat)
  48. make given matrix zero
  49. Parameters:
  50. | *[in,out]* **mat** matrix to
  51. .. c:function:: void glm_mat3_mul(mat3 m1, mat3 m2, mat3 dest)
  52. multiply m1 and m2 to dest
  53. m1, m2 and dest matrices can be same matrix, it is possible to write this:
  54. .. code-block:: c
  55. mat3 m = GLM_MAT3_IDENTITY_INIT;
  56. glm_mat3_mul(m, m, m);
  57. Parameters:
  58. | *[in]* **m1** left matrix
  59. | *[in]* **m2** right matrix
  60. | *[out]* **dest** destination matrix
  61. .. c:function:: void glm_mat3_transpose_to(mat3 m, mat3 dest)
  62. transpose mat4 and store in dest
  63. source matrix will not be transposed unless dest is m
  64. Parameters:
  65. | *[in]* **mat** source
  66. | *[out]* **dest** destination
  67. .. c:function:: void glm_mat3_transpose(mat3 m)
  68. tranpose mat3 and store result in same matrix
  69. Parameters:
  70. | *[in]* **mat** source
  71. | *[out]* **dest** destination
  72. .. c:function:: void glm_mat3_mulv(mat3 m, vec3 v, vec3 dest)
  73. multiply mat3 with vec3 (column vector) and store in dest vector
  74. Parameters:
  75. | *[in]* **m** mat3 (left)
  76. | *[in]* **v** vec3 (right, column vector)
  77. | *[out]* **dest** destination (result, column vector)
  78. .. c:function:: void glm_mat3_quat(mat3 m, versor dest)
  79. convert mat3 to quaternion
  80. Parameters:
  81. | *[in]* **m** rotation matrix
  82. | *[out]* **dest** destination quaternion
  83. .. c:function:: void glm_mat3_scale(mat3 m, float s)
  84. multiply matrix with scalar
  85. Parameters:
  86. | *[in, out]* **m** matrix
  87. | *[in]* **s** scalar
  88. .. c:function:: float glm_mat3_det(mat3 mat)
  89. returns mat3 determinant
  90. Parameters:
  91. | *[in]* **mat** matrix
  92. Returns:
  93. mat3 determinant
  94. .. c:function:: void glm_mat3_inv(mat3 mat, mat3 dest)
  95. inverse mat3 and store in dest
  96. Parameters:
  97. | *[in]* **mat** matrix
  98. | *[out]* **dest** destination (inverse matrix)
  99. .. c:function:: void glm_mat3_trace(mat3 m)
  100. | sum of the elements on the main diagonal from upper left to the lower right
  101. Parameters:
  102. | *[in]* **m** matrix
  103. Returns:
  104. trace of matrix
  105. .. c:function:: void glm_mat3_swap_col(mat3 mat, int col1, int col2)
  106. swap two matrix columns
  107. Parameters:
  108. | *[in, out]* **mat** matrix
  109. | *[in]* **col1** col1
  110. | *[in]* **col2** col2
  111. .. c:function:: void glm_mat3_swap_row(mat3 mat, int row1, int row2)
  112. swap two matrix rows
  113. Parameters:
  114. | *[in, out]* **mat** matrix
  115. | *[in]* **row1** row1
  116. | *[in]* **row2** row2
  117. .. c:function:: float glm_mat3_rmc(vec3 r, mat3 m, vec3 c)
  118. | **rmc** stands for **Row** * **Matrix** * **Column**
  119. | helper for R (row vector) * M (matrix) * C (column vector)
  120. | the result is scalar because R * M = Matrix1x3 (row vector),
  121. | then Matrix1x3 * Vec3 (column vector) = Matrix1x1 (Scalar)
  122. Parameters:
  123. | *[in]* **r** row vector or matrix1x3
  124. | *[in]* **m** matrix3x3
  125. | *[in]* **c** column vector or matrix3x1
  126. Returns:
  127. scalar value e.g. Matrix1x1
  128. .. c:function:: void glm_mat3_make(float * __restrict src, mat3 dest)
  129. Create mat3 matrix from pointer
  130. | NOTE: **@src** must contain at least 9 elements.
  131. Parameters:
  132. | *[in]* **src** pointer to an array of floats
  133. | *[out]* **dest** destination matrix3x3