mirror of
https://github.com/recp/cglm.git
synced 2025-12-25 04:44:58 +00:00
sphere and aabb
This commit is contained in:
@@ -45,3 +45,4 @@ Follow the :doc:`build` documentation for this
|
||||
util
|
||||
io
|
||||
call
|
||||
sphere
|
||||
|
||||
@@ -29,6 +29,10 @@ Functions:
|
||||
#. :c:func:`glm_aabb_size`
|
||||
#. :c:func:`glm_aabb_radius`
|
||||
#. :c:func:`glm_aabb_center`
|
||||
#. :c:func:`glm_aabb_aabb`
|
||||
#. :c:func:`glm_aabb_sphere`
|
||||
#. :c:func:`glm_aabb_point`
|
||||
#. :c:func:`glm_aabb_contains`
|
||||
|
||||
Functions documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -137,6 +141,41 @@ Functions documentation
|
||||
|
||||
| computes center point of AABB
|
||||
|
||||
Parameters:
|
||||
| *[in]* **box** bounding box
|
||||
| *[out]* **dest** center of bounding box
|
||||
|
||||
.. c:function:: bool glm_aabb_aabb(vec3 box[2], vec3 other[2])
|
||||
|
||||
| check if two AABB intersects
|
||||
|
||||
Parameters:
|
||||
| *[in]* **box** bounding box
|
||||
| *[out]* **box** center of bounding box
|
||||
| *[out]* **other** other bounding box
|
||||
|
||||
.. c:function:: bool glm_aabb_sphere(vec3 box[2], vec4 s)
|
||||
|
||||
| check if AABB intersects with sphere
|
||||
|
||||
| https://github.com/erich666/GraphicsGems/blob/master/gems/BoxSphere.c
|
||||
| Solid Box - Solid Sphere test.
|
||||
|
||||
Parameters:
|
||||
| *[in]* **box** solid bounding box
|
||||
| *[out]* **s** solid sphere
|
||||
|
||||
.. c:function:: bool glm_aabb_point(vec3 box[2], vec3 point)
|
||||
|
||||
| check if point is inside of AABB
|
||||
|
||||
Parameters:
|
||||
| *[in]* **box** bounding box
|
||||
| *[out]* **point** point
|
||||
|
||||
.. c:function:: bool glm_aabb_contains(vec3 box[2], vec3 other[2])
|
||||
|
||||
| check if AABB contains other AABB
|
||||
|
||||
Parameters:
|
||||
| *[in]* **box** bounding box
|
||||
| *[out]* **other** other bounding box
|
||||
|
||||
65
docs/source/sphere.rst
Normal file
65
docs/source/sphere.rst
Normal file
@@ -0,0 +1,65 @@
|
||||
.. default-domain:: C
|
||||
|
||||
Sphere
|
||||
================================================================================
|
||||
|
||||
Header: cglm/sphere.h
|
||||
|
||||
**Definition of sphere:**
|
||||
|
||||
Sphere Representation in cglm is *vec4*: **[center.x, center.y, center.z, radii]**
|
||||
|
||||
You can call any vec3 function by pasing sphere. Because first three elements
|
||||
defines center of sphere.
|
||||
|
||||
Table of contents (click to go):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Functions:
|
||||
|
||||
1. :c:func:`glm_sphere_radii`
|
||||
#. :c:func:`glm_sphere_transform`
|
||||
#. :c:func:`glm_sphere_merge`
|
||||
#. :c:func:`glm_sphere_sphere`
|
||||
|
||||
Functions documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. c:function:: float glm_sphere_radii(vec4 s)
|
||||
|
||||
| helper for getting sphere radius
|
||||
|
||||
Parameters:
|
||||
| *[in]* **s** sphere
|
||||
|
||||
Returns:
|
||||
returns radii
|
||||
|
||||
.. c:function:: void glm_sphere_transform(vec4 s, mat4 m, vec4 dest)
|
||||
|
||||
| apply transform to sphere, it is just wrapper for glm_mat4_mulv3
|
||||
|
||||
Parameters:
|
||||
| *[in]* **s** sphere
|
||||
| *[in]* **m** transform matrix
|
||||
| *[out]* **dest** transformed sphere
|
||||
|
||||
.. c:function:: void glm_sphere_merge(vec4 s1, vec4 s2, vec4 dest)
|
||||
|
||||
| merges two spheres and creates a new one
|
||||
|
||||
two sphere must be in same space, for instance if one in world space then
|
||||
the other must be in world space too, not in local space.
|
||||
|
||||
Parameters:
|
||||
| *[in]* **s1** sphere 1
|
||||
| *[in]* **s2** sphere 2
|
||||
| *[out]* **dest** merged/extended sphere
|
||||
|
||||
.. c:function:: bool glm_sphere_sphere(vec4 s1, vec4 s2)
|
||||
|
||||
| check if two sphere intersects
|
||||
|
||||
Parameters:
|
||||
| *[in]* **s1** sphere
|
||||
| *[in]* **s2** other sphere
|
||||
Reference in New Issue
Block a user