ivec3.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. .. default-domain:: C
  2. ivec3
  3. =====
  4. Header: cglm/ivec3.h
  5. Table of contents (click to go):
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. Macros:
  8. 1. GLM_IVEC3_ONE_INIT
  9. #. GLM_IVEC3_ZERO_INIT
  10. #. GLM_IVEC3_ONE
  11. #. GLM_IVEC3_ZERO
  12. Functions:
  13. 1. :c:func:`glm_ivec3`
  14. #. :c:func:`glm_ivec3_copy`
  15. #. :c:func:`glm_ivec3_zero`
  16. #. :c:func:`glm_ivec3_one`
  17. #. :c:func:`glm_ivec3_dot`
  18. #. :c:func:`glm_ivec3_norm2`
  19. #. :c:func:`glm_ivec3_norm`
  20. #. :c:func:`glm_ivec3_add`
  21. #. :c:func:`glm_ivec3_adds`
  22. #. :c:func:`glm_ivec3_sub`
  23. #. :c:func:`glm_ivec3_subs`
  24. #. :c:func:`glm_ivec3_mul`
  25. #. :c:func:`glm_ivec3_scale`
  26. #. :c:func:`glm_ivec3_div`
  27. #. :c:func:`glm_ivec3_divs`
  28. #. :c:func:`glm_ivec3_mod`
  29. #. :c:func:`glm_ivec3_distance2`
  30. #. :c:func:`glm_ivec3_distance`
  31. #. :c:func:`glm_ivec3_fill`
  32. #. :c:func:`glm_ivec3_eq`
  33. #. :c:func:`glm_ivec3_eqv`
  34. #. :c:func:`glm_ivec3_maxv`
  35. #. :c:func:`glm_ivec3_minv`
  36. #. :c:func:`glm_ivec3_clamp`
  37. #. :c:func:`glm_ivec2_abs`
  38. Functions documentation
  39. ~~~~~~~~~~~~~~~~~~~~~~~
  40. .. c:function:: void glm_ivec3(ivec4 v4, ivec3 dest)
  41. init ivec3 using ivec4
  42. Parameters:
  43. | *[in]* **v** vector
  44. | *[out]* **dest** destination
  45. .. c:function:: void glm_ivec3_copy(ivec3 a, ivec3 dest)
  46. copy all members of [a] to [dest]
  47. Parameters:
  48. | *[in]* **a** source vector
  49. | *[out]* **dest** destination
  50. .. c:function:: void glm_ivec3_zero(ivec3 v)
  51. set all members of [v] to zero
  52. Parameters:
  53. | *[out]* **v** vector
  54. .. c:function:: void glm_ivec3_one(ivec3 v)
  55. set all members of [v] to one
  56. Parameters:
  57. | *[out]* **v** vector
  58. .. c:function:: int glm_ivec3_dot(ivec3 a, ivec3 b)
  59. dot product of ivec3
  60. Parameters:
  61. | *[in]* **a** vector1
  62. | *[in]* **b** vector2
  63. Returns:
  64. dot product
  65. .. c:function:: int glm_ivec3_norm2(ivec3 v)
  66. norm * norm (magnitude) of vector
  67. we can use this func instead of calling norm * norm, because it would call
  68. sqrtf function twice but with this func we can avoid func call, maybe this is
  69. not good name for this func
  70. Parameters:
  71. | *[in]* **v** vector
  72. Returns:
  73. square of norm / magnitude, cast to an integer
  74. .. c:function:: int glm_ivec3_norm(ivec3 vec)
  75. | euclidean norm (magnitude), also called L2 norm
  76. | this will give magnitude of vector in euclidean space
  77. Parameters:
  78. | *[in]* **vec** vector
  79. .. c:function:: void glm_ivec3_add(ivec3 a, ivec3 b, ivec3 dest)
  80. add vector [a] to vector [b] and store result in [dest]
  81. Parameters:
  82. | *[in]* **a** first vector
  83. | *[in]* **b** second vector
  84. | *[out]* **dest** destination
  85. .. c:function:: void glm_ivec3_adds(ivec3 v, int s, ivec3 dest)
  86. add scalar s to vector [v] and store result in [dest]
  87. Parameters:
  88. | *[in]* **v** vector
  89. | *[in]* **s** scalar
  90. | *[out]* **dest** destination
  91. .. c:function:: void glm_ivec3_sub(ivec3 a, ivec3 b, ivec3 dest)
  92. subtract vector [b] from vector [a] and store result in [dest]
  93. Parameters:
  94. | *[in]* **a** first vector
  95. | *[in]* **b** second vector
  96. | *[out]* **dest** destination
  97. .. c:function:: void glm_ivec3_subs(ivec3 v, int s, ivec3 dest)
  98. subtract scalar s from vector [v] and store result in [dest]
  99. Parameters:
  100. | *[in]* **v** vector
  101. | *[in]* **s** scalar
  102. | *[out]* **dest** destination
  103. .. c:function:: void glm_ivec3_mul(ivec3 a, ivec3 b, ivec3 dest)
  104. multiply vector [a] with vector [b] and store result in [dest]
  105. Parameters:
  106. | *[in]* **a** first vector
  107. | *[in]* **b** second vector
  108. | *[out]* **dest** destination
  109. .. c:function:: void glm_ivec3_scale(ivec3 v, int s, ivec3 dest)
  110. multiply vector [a] with scalar s and store result in [dest]
  111. Parameters:
  112. | *[in]* **v** vector
  113. | *[in]* **s** scalar
  114. | *[out]* **dest** destination
  115. .. c:function:: void glm_ivec3_div(ivec3 a, ivec3 b, ivec3 dest)
  116. div vector with another component-wise division: d = a / b
  117. Parameters:
  118. | *[in]* **a** vector 1
  119. | *[in]* **b** vector 2
  120. | *[out]* **dest** result = (a[0] / b[0], a[1] / b[1], a[2] / b[2])
  121. .. c:function:: void glm_ivec3_divs(ivec3 v, int s, ivec3 dest)
  122. div vector with scalar: d = v / s
  123. Parameters:
  124. | *[in]* **v** vector
  125. | *[in]* **s** scalar
  126. | *[out]* **dest** result = (a[0] / s, a[1] / s, a[2] / s)
  127. .. c:function:: void glm_ivec3_mod(ivec3 a, ivec3 b, ivec3 dest)
  128. mod vector with another component-wise modulo: d = a % b
  129. Parameters:
  130. | *[in]* **a** vector
  131. | *[in]* **b** scalar
  132. | *[out]* **dest** result = (a[0] % b[0], a[1] % b[1], a[2] % b[2])
  133. .. c:function:: int glm_ivec3_distance2(ivec3 a, ivec3 b)
  134. squared distance between two vectors
  135. Parameters:
  136. | *[in]* **a** first vector
  137. | *[in]* **b** second vector
  138. Returns:
  139. squared distance (distance * distance)
  140. .. c:function:: float glm_ivec3_distance(ivec3 a, ivec3 b)
  141. distance between two vectors
  142. Parameters:
  143. | *[in]* **a** first vector
  144. | *[in]* **b** second vector
  145. Returns:
  146. distance
  147. .. c:function:: void glm_ivec3_fill(ivec3 v, int val)
  148. fill a vector with specified value
  149. Parameters:
  150. | *[out]* **v** vector
  151. | *[in]* **val** value
  152. .. c:function:: bool glm_ivec3_eq(ivec3 v, int val)
  153. check if vector is equal to value
  154. Parameters:
  155. | *[in]* **v** vector
  156. | *[in]* **val** value
  157. .. c:function:: bool glm_ivec3_eqv(ivec3 v1, ivec3 v2)
  158. check if vector is equal to another vector
  159. Parameters:
  160. | *[in]* **vec** vector 1
  161. | *[in]* **vec** vector 2
  162. .. c:function:: void glm_ivec3_maxv(ivec3 a, ivec3 b, ivec3 dest)
  163. set each member of dest to greater of vector a and b
  164. Parameters:
  165. | *[in]* **a** first vector
  166. | *[in]* **b** second vector
  167. | *[out]* **dest** destination
  168. .. c:function:: void glm_ivec3_minv(ivec3 a, ivec3 b, ivec3 dest)
  169. set each member of dest to lesser of vector a and b
  170. Parameters:
  171. | *[in]* **a** first vector
  172. | *[in]* **b** second vector
  173. | *[out]* **dest** destination
  174. .. c:function:: void glm_ivec3_clamp(ivec3 v, int minVal, int maxVal)
  175. clamp each member of [v] between minVal and maxVal (inclusive)
  176. Parameters:
  177. | *[in, out]* **v** vector
  178. | *[in]* **minVal** minimum value
  179. | *[in]* **maxVal** maximum value
  180. .. c:function:: void glm_ivec3_abs(ivec3 v, ivec3 dest)
  181. absolute value of each vector item
  182. Parameters:
  183. | *[in]* **v** vector
  184. | *[out]* **dest** destination vector