mirror of
https://github.com/recp/cglm.git
synced 2025-10-03 16:51:35 +00:00
sphere point intersection
This commit is contained in:
@@ -21,6 +21,7 @@ Functions:
|
||||
#. :c:func:`glm_sphere_transform`
|
||||
#. :c:func:`glm_sphere_merge`
|
||||
#. :c:func:`glm_sphere_sphere`
|
||||
#. :c:func:`glm_sphere_point`
|
||||
|
||||
Functions documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -63,3 +64,11 @@ Functions documentation
|
||||
Parameters:
|
||||
| *[in]* **s1** sphere
|
||||
| *[in]* **s2** other sphere
|
||||
|
||||
.. c:function:: bool glm_sphere_point(vec4 s, vec3 point)
|
||||
|
||||
| check if sphere intersects with point
|
||||
|
||||
Parameters:
|
||||
| *[in]* **s** sphere
|
||||
| *[in]* **point** point
|
||||
|
@@ -29,4 +29,8 @@ CGLM_EXPORT
|
||||
bool
|
||||
glmc_sphere_sphere(vec4 s1, vec4 s2);
|
||||
|
||||
CGLM_EXPORT
|
||||
bool
|
||||
glmc_sphere_point(vec4 s, vec3 point);
|
||||
|
||||
#endif /* cglmc_sphere_h */
|
||||
|
@@ -82,4 +82,18 @@ glm_sphere_sphere(vec4 s1, vec4 s2) {
|
||||
return glm_vec_distance2(s1, s2) <= glm_pow2(s1[3] + s2[3]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief check if sphere intersects with point
|
||||
*
|
||||
* @param[in] s sphere
|
||||
* @param[in] point point
|
||||
*/
|
||||
CGLM_INLINE
|
||||
bool
|
||||
glm_sphere_point(vec4 s, vec3 point) {
|
||||
float rr;
|
||||
rr = s[3] * s[3];
|
||||
return glm_vec_distance2(point, s) <= rr;
|
||||
}
|
||||
|
||||
#endif /* cglm_sphere_h */
|
||||
|
@@ -31,3 +31,9 @@ bool
|
||||
glmc_sphere_sphere(vec4 s1, vec4 s2) {
|
||||
return glm_sphere_sphere(s1, s2);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
bool
|
||||
glmc_sphere_point(vec4 s, vec3 point) {
|
||||
return glm_sphere_point(s, point);
|
||||
}
|
||||
|
Reference in New Issue
Block a user