Update ivec2 and ivec3 documentation

This commit is contained in:
Vitaliy Klychkov
2024-01-27 13:45:27 +00:00
parent 30845124b4
commit 029bead207
2 changed files with 122 additions and 0 deletions

View File

@@ -21,12 +21,17 @@ Functions:
#. :c:func:`glm_ivec2_copy`
#. :c:func:`glm_ivec2_zero`
#. :c:func:`glm_ivec2_one`
#. :c:func:`glm_ivec2_dot`
#. :c:func:`glm_ivec2_cross`
#. :c:func:`glm_ivec2_add`
#. :c:func:`glm_ivec2_adds`
#. :c:func:`glm_ivec2_sub`
#. :c:func:`glm_ivec2_subs`
#. :c:func:`glm_ivec2_mul`
#. :c:func:`glm_ivec2_scale`
#. :c:func:`glm_ivec2_div`
#. :c:func:`glm_ivec2_divs`
#. :c:func:`glm_ivec2_mod`
#. :c:func:`glm_ivec2_distance2`
#. :c:func:`glm_ivec2_distance`
#. :c:func:`glm_ivec2_maxv`
@@ -67,6 +72,30 @@ Functions documentation
Parameters:
| *[out]* **v** vector
.. c:function:: int glm_ivec2_dot(ivec2 a, ivec2 b)
dot product of ivec2
Parameters:
| *[in]* **a** vector1
| *[in]* **b** vector2
Returns:
dot product
.. c:function:: int glm_ivec2_cross(ivec2 a, ivec2 b)
cross product of two vector (RH)
| ref: http://allenchou.net/2013/07/cross-product-of-2d-vectors/
Parameters:
| *[in]* **a** vector 1
| *[in]* **b** vector 2
Returns:
Z component of cross product
.. c:function:: void glm_ivec2_add(ivec2 a, ivec2 b, ivec2 dest)
add vector [a] to vector [b] and store result in [dest]
@@ -121,6 +150,33 @@ Functions documentation
| *[in]* **s** scalar
| *[out]* **dest** destination
.. c:function:: void glm_ivec2_div(ivec2 a, ivec2 b, ivec2 dest)
div vector with another component-wise division: d = a / b
Parameters:
| *[in]* **a** vector 1
| *[in]* **b** vector 2
| *[out]* **dest** result = (a[0] / b[0], a[1] / b[1], a[2] / b[2])
.. c:function:: void glm_ivec2_divs(ivec2 v, int s, ivec2 dest)
div vector with scalar: d = v / s
Parameters:
| *[in]* **v** vector
| *[in]* **s** scalar
| *[out]* **dest** result = (a[0] / s, a[1] / s, a[2] / s)
.. c:function:: void glm_ivec2_mod(ivec2 a, ivec2 b, ivec2 dest)
mod vector with another component-wise modulo: d = a % b
Parameters:
| *[in]* **a** vector
| *[in]* **b** scalar
| *[out]* **dest** result = (a[0] % b[0], a[1] % b[1])
.. c:function:: int glm_ivec2_distance2(ivec2 a, ivec2 b)
squared distance between two vectors

View File

@@ -21,12 +21,18 @@ Functions:
#. :c:func:`glm_ivec3_copy`
#. :c:func:`glm_ivec3_zero`
#. :c:func:`glm_ivec3_one`
#. :c:func:`glm_ivec3_dot`
#. :c:func:`glm_ivec3_norm2`
#. :c:func:`glm_ivec3_norm`
#. :c:func:`glm_ivec3_add`
#. :c:func:`glm_ivec3_adds`
#. :c:func:`glm_ivec3_sub`
#. :c:func:`glm_ivec3_subs`
#. :c:func:`glm_ivec3_mul`
#. :c:func:`glm_ivec3_scale`
#. :c:func:`glm_ivec3_div`
#. :c:func:`glm_ivec3_divs`
#. :c:func:`glm_ivec3_mod`
#. :c:func:`glm_ivec3_distance2`
#. :c:func:`glm_ivec3_distance`
#. :c:func:`glm_ivec3_fill`
@@ -70,6 +76,39 @@ Functions documentation
Parameters:
| *[out]* **v** vector
.. c:function:: int glm_ivec3_dot(ivec3 a, ivec3 b)
dot product of ivec3
Parameters:
| *[in]* **a** vector1
| *[in]* **b** vector2
Returns:
dot product
.. c:function:: int glm_ivec3_norm2(ivec3 v)
norm * norm (magnitude) of vector
we can use this func instead of calling norm * norm, because it would call
sqrtf fuction twice but with this func we can avoid func call, maybe this is
not good name for this func
Parameters:
| *[in]* **v** vector
Returns:
square of norm / magnitude, cast to an integer
.. c:function:: int glm_ivec3_norm(ivec3 vec)
| euclidean norm (magnitude), also called L2 norm
| this will give magnitude of vector in euclidean space
Parameters:
| *[in]* **vec** vector
.. c:function:: void glm_ivec3_add(ivec3 a, ivec3 b, ivec3 dest)
add vector [a] to vector [b] and store result in [dest]
@@ -124,6 +163,33 @@ Functions documentation
| *[in]* **s** scalar
| *[out]* **dest** destination
.. c:function:: void glm_ivec3_div(ivec3 a, ivec3 b, ivec3 dest)
div vector with another component-wise division: d = a / b
Parameters:
| *[in]* **a** vector 1
| *[in]* **b** vector 2
| *[out]* **dest** result = (a[0] / b[0], a[1] / b[1], a[2] / b[2])
.. c:function:: void glm_ivec3_divs(ivec3 v, int s, ivec3 dest)
div vector with scalar: d = v / s
Parameters:
| *[in]* **v** vector
| *[in]* **s** scalar
| *[out]* **dest** result = (a[0] / s, a[1] / s, a[2] / s)
.. c:function:: void glm_ivec3_mod(ivec3 a, ivec3 b, ivec3 dest)
mod vector with another component-wise modulo: d = a % b
Parameters:
| *[in]* **a** vector
| *[in]* **b** scalar
| *[out]* **dest** result = (a[0] % b[0], a[1] % b[1], a[2] % b[2])
.. c:function:: int glm_ivec3_distance2(ivec3 a, ivec3 b)
squared distance between two vectors