mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 12:32:40 +00:00
docs: add docs for vec4
This commit is contained in:
@@ -31,3 +31,5 @@ Follow the :doc:`build` documentation for this
|
||||
mat3
|
||||
vec3
|
||||
vec3-ext
|
||||
vec4
|
||||
vec4-ext
|
||||
|
||||
@@ -52,7 +52,7 @@ Functions documentation
|
||||
| *[in]* **v** vector
|
||||
| *[in]* **val** value
|
||||
|
||||
.. c:function:: bool glm_vec_eq_eps(vec4 v, float val)
|
||||
.. c:function:: bool glm_vec_eq_eps(vec3 v, float val)
|
||||
|
||||
check if vector is equal to value (with epsilon)
|
||||
|
||||
|
||||
98
docs/source/vec4-ext.rst
Normal file
98
docs/source/vec4-ext.rst
Normal file
@@ -0,0 +1,98 @@
|
||||
.. default-domain:: C
|
||||
|
||||
vec4 extra
|
||||
==========
|
||||
|
||||
Header: cglm/vec4-ext.h
|
||||
|
||||
There are some functions are in called in extra header. These are called extra
|
||||
because they are not used like other functions in vec4.h in the future some of
|
||||
these functions ma be moved to vec4 header.
|
||||
|
||||
Table of contents (clik func/macro to go):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Functions:
|
||||
|
||||
1. :c:func:`glm_vec4_mulv`
|
||||
#. :c:func:`glm_vec4_broadcast`
|
||||
#. :c:func:`glm_vec4_eq`
|
||||
#. :c:func:`glm_vec4_eq_eps`
|
||||
#. :c:func:`glm_vec4_eq_all`
|
||||
#. :c:func:`glm_vec4_eqv`
|
||||
#. :c:func:`glm_vec4_eqv_eps`
|
||||
#. :c:func:`glm_vec4_max`
|
||||
#. :c:func:`glm_vec4_min`
|
||||
|
||||
Functions documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. c:function:: void glm_vec4_mulv(vec4 a, vec4 b, vec4 d)
|
||||
|
||||
multiplies individual items
|
||||
|
||||
Parameters:
|
||||
| *[in]* **a** vec1
|
||||
| *[in]* **b** vec2
|
||||
| *[out]* **d** destination
|
||||
|
||||
.. c:function:: void glm_vec4_broadcast(float val, vec4 d)
|
||||
|
||||
fill a vector with specified value
|
||||
|
||||
Parameters:
|
||||
| *[in]* **val** value
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: bool glm_vec4_eq(vec4 v, float val)
|
||||
|
||||
check if vector is equal to value (without epsilon)
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
| *[in]* **val** value
|
||||
|
||||
.. c:function:: bool glm_vec4_eq_eps(vec4 v, float val)
|
||||
|
||||
check if vector is equal to value (with epsilon)
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
| *[in]* **val** value
|
||||
|
||||
.. c:function:: bool glm_vec4_eq_all(vec4 v)
|
||||
|
||||
check if vectors members are equal (without epsilon)
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
|
||||
.. c:function:: bool glm_vec4_eqv(vec4 v1, vec4 v2)
|
||||
|
||||
check if vector is equal to another (without epsilon) vector
|
||||
|
||||
Parameters:
|
||||
| *[in]* **vec** vector 1
|
||||
| *[in]* **vec** vector 2
|
||||
|
||||
.. c:function:: bool glm_vec4_eqv_eps(vec4 v1, vec4 v2)
|
||||
|
||||
check if vector is equal to another (with epsilon)
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
| *[in]* **v2** vector2
|
||||
|
||||
.. c:function:: float glm_vec4_max(vec4 v)
|
||||
|
||||
max value of vector
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
|
||||
.. c:function:: float glm_vec4_min(vec4 v)
|
||||
|
||||
min value of vector
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
205
docs/source/vec4.rst
Normal file
205
docs/source/vec4.rst
Normal file
@@ -0,0 +1,205 @@
|
||||
.. default-domain:: C
|
||||
|
||||
vec4
|
||||
====
|
||||
|
||||
Header: cglm/vec4.h
|
||||
|
||||
Table of contents (clik func/macro to go):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Macros:
|
||||
|
||||
1. glm_vec4_dup3(v, dest)
|
||||
#. glm_vec4_dup(v, dest)
|
||||
#. GLM_VEC4_ONE_INIT
|
||||
#. GLM_VEC4_BLACK_INIT
|
||||
#. GLM_VEC4_ZERO_INIT
|
||||
#. GLM_VEC4_ONE
|
||||
#. GLM_VEC4_BLACK
|
||||
#. GLM_VEC4_ZERO
|
||||
|
||||
Functions:
|
||||
|
||||
1. :c:func:`glm_vec4`
|
||||
#. :c:func:`glm_vec4_copy3`
|
||||
#. :c:func:`glm_vec4_copy`
|
||||
#. :c:func:`glm_vec4_dot`
|
||||
#. :c:func:`glm_vec4_norm2`
|
||||
#. :c:func:`glm_vec4_norm`
|
||||
#. :c:func:`glm_vec4_add`
|
||||
#. :c:func:`glm_vec4_sub`
|
||||
#. :c:func:`glm_vec4_scale`
|
||||
#. :c:func:`glm_vec4_scale_as`
|
||||
#. :c:func:`glm_vec4_flipsign`
|
||||
#. :c:func:`glm_vec4_inv`
|
||||
#. :c:func:`glm_vec4_inv_to`
|
||||
#. :c:func:`glm_vec4_normalize`
|
||||
#. :c:func:`glm_vec4_normalize_to`
|
||||
#. :c:func:`glm_vec4_distance`
|
||||
#. :c:func:`glm_vec4_maxv`
|
||||
#. :c:func:`glm_vec4_minv`
|
||||
|
||||
Functions documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. c:function:: void glm_vec4(vec3 v3, float last, vec4 dest)
|
||||
|
||||
init vec4 using vec3, since you are initializing vec4 with vec3
|
||||
you need to set last item. cglm could set it zero but making it parameter
|
||||
gives more control
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v3** vector4
|
||||
| *[in]* **last** last item of vec4
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: void glm_vec4_copy3(vec4 a, vec3 dest)
|
||||
|
||||
copy first 3 members of [a] to [dest]
|
||||
|
||||
Parameters:
|
||||
| *[in]* **a** source
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: void glm_vec4_copy(vec4 v, vec4 dest)
|
||||
|
||||
copy all members of [a] to [dest]
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** source
|
||||
| *[in]* **dest** destination
|
||||
|
||||
.. c:function:: float glm_vec4_dot(vec4 a, vec4 b)
|
||||
|
||||
dot product of vec4
|
||||
|
||||
Parameters:
|
||||
| *[in]* **a** vector1
|
||||
| *[in]* **b** vector2
|
||||
|
||||
Returns:
|
||||
dot product
|
||||
|
||||
.. c:function:: float glm_vec4_norm2(vec4 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
|
||||
|
||||
.. c:function:: float glm_vec4_norm(vec4 vec)
|
||||
|
||||
norm (magnitude) of vec4
|
||||
|
||||
Parameters:
|
||||
| *[in]* **vec** vector
|
||||
|
||||
.. c:function:: void glm_vec4_add(vec4 v1, vec4 v2, vec4 dest)
|
||||
|
||||
add v2 vector to v1 vector store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
| *[in]* **v2** vector2
|
||||
| *[out]* **dest** destination vector
|
||||
|
||||
.. c:function:: void glm_vec4_sub(vec4 v1, vec4 v2, vec4 dest)
|
||||
|
||||
subtract v2 vector from v1 vector store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
| *[in]* **v2** vector2
|
||||
| *[out]* **dest** destination vector
|
||||
|
||||
.. c:function:: void glm_vec4_scale(vec4 v, float s, vec4 dest)
|
||||
|
||||
multiply/scale vec4 vector with scalar: result = v * s
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
| *[in]* **s** scalar
|
||||
| *[out]* **dest** destination vector
|
||||
|
||||
.. c:function:: void glm_vec4_scale_as(vec4 v, float s, vec4 dest)
|
||||
|
||||
make vec4 vector scale as specified: result = unit(v) * s
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** vector
|
||||
| *[in]* **s** scalar
|
||||
| *[out]* **dest** destination vector
|
||||
|
||||
.. c:function:: void glm_vec4_flipsign(vec4 v)
|
||||
|
||||
flip sign of all vec4 members
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **v** vector
|
||||
|
||||
.. c:function:: void glm_vec4_inv(vec4 v)
|
||||
|
||||
make vector as inverse/opposite of itself
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **v** vector
|
||||
|
||||
.. c:function:: void glm_vec4_inv_to(vec4 v, vec4 dest)
|
||||
|
||||
inverse/opposite vector
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v** source
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: void glm_vec4_normalize(vec4 v)
|
||||
|
||||
normalize vec4 and store result in same vec
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **v** vector
|
||||
|
||||
.. c:function:: void glm_vec4_normalize_to(vec4 vec, vec4 dest)
|
||||
|
||||
normalize vec4 to dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **vec** source
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: float glm_vec4_distance(vec4 v1, vec4 v2)
|
||||
|
||||
distance between two vectors
|
||||
|
||||
Parameters:
|
||||
| *[in]* **mat** vector1
|
||||
| *[in]* **row1** vector2
|
||||
|
||||
Returns:
|
||||
| distance
|
||||
|
||||
.. c:function:: void glm_vec4_maxv(vec4 v1, vec4 v2, vec4 dest)
|
||||
|
||||
max values of vectors
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
| *[in]* **v2** vector2
|
||||
| *[out]* **dest** destination
|
||||
|
||||
.. c:function:: void glm_vec4_minv(vec4 v1, vec4 v2, vec4 dest)
|
||||
|
||||
min values of vectors
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
| *[in]* **v2** vector2
|
||||
| *[out]* **dest** destination
|
||||
@@ -20,7 +20,7 @@
|
||||
GLM_VEC4_ONE
|
||||
GLM_VEC4_BLACK
|
||||
GLM_VEC4_ZERO
|
||||
|
||||
|
||||
Functions:
|
||||
CGLM_INLINE void glm_vec4(vec3 v3, float last, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_copy3(vec4 a, vec3 dest);
|
||||
|
||||
Reference in New Issue
Block a user