mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
sphere point intersection
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user