sphere.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .. default-domain:: C
  2. Sphere
  3. ================================================================================
  4. Header: cglm/sphere.h
  5. **Definition of sphere:**
  6. Sphere Representation in cglm is *vec4*: **[center.x, center.y, center.z, radii]**
  7. You can call any vec3 function by pasing sphere. Because first three elements
  8. defines center of sphere.
  9. Table of contents (click to go):
  10. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. Functions:
  12. 1. :c:func:`glm_sphere_radii`
  13. #. :c:func:`glm_sphere_transform`
  14. #. :c:func:`glm_sphere_merge`
  15. #. :c:func:`glm_sphere_sphere`
  16. #. :c:func:`glm_sphere_point`
  17. Functions documentation
  18. ~~~~~~~~~~~~~~~~~~~~~~~
  19. .. c:function:: float glm_sphere_radii(vec4 s)
  20. | helper for getting sphere radius
  21. Parameters:
  22. | *[in]* **s** sphere
  23. Returns:
  24. returns radii
  25. .. c:function:: void glm_sphere_transform(vec4 s, mat4 m, vec4 dest)
  26. | apply transform to sphere, it is just wrapper for glm_mat4_mulv3
  27. Parameters:
  28. | *[in]* **s** sphere
  29. | *[in]* **m** transform matrix
  30. | *[out]* **dest** transformed sphere
  31. .. c:function:: void glm_sphere_merge(vec4 s1, vec4 s2, vec4 dest)
  32. | merges two spheres and creates a new one
  33. two sphere must be in same space, for instance if one in world space then
  34. the other must be in world space too, not in local space.
  35. Parameters:
  36. | *[in]* **s1** sphere 1
  37. | *[in]* **s2** sphere 2
  38. | *[out]* **dest** merged/extended sphere
  39. .. c:function:: bool glm_sphere_sphere(vec4 s1, vec4 s2)
  40. | check if two sphere intersects
  41. Parameters:
  42. | *[in]* **s1** sphere
  43. | *[in]* **s2** other sphere
  44. .. c:function:: bool glm_sphere_point(vec4 s, vec3 point)
  45. | check if sphere intersects with point
  46. Parameters:
  47. | *[in]* **s** sphere
  48. | *[in]* **point** point