docs: ray sphere docs improvements

This commit is contained in:
Recep Aslantas
2024-03-29 08:05:10 +03:00
parent 55521ecd61
commit 9df36ce005
3 changed files with 10 additions and 1 deletions

View File

@@ -36,6 +36,8 @@ Functions documentation
ray sphere intersection
returns false if there is no intersection if true:
- t1 > 0, t2 > 0: ray intersects the sphere at t1 and t2 both ahead of the origin
- t1 < 0, t2 > 0: ray starts inside the sphere, exits at t2
- t1 < 0, t2 < 0: no intersection ahead of the ray

View File

@@ -82,6 +82,8 @@ glm_ray_triangle(vec3 origin,
/*!
* @brief ray sphere intersection
*
* returns false if there is no intersection if true:
*
* - t1 > 0, t2 > 0: ray intersects the sphere at t1 and t2 both ahead of the origin
* - t1 < 0, t2 > 0: ray starts inside the sphere, exits at t2
* - t1 < 0, t2 < 0: no intersection ahead of the ray
@@ -94,6 +96,8 @@ glm_ray_triangle(vec3 origin,
* @param[in] s sphere [center.x, center.y, center.z, radii]
* @param[in] t1 near point1 (closer to origin)
* @param[in] t2 far point2 (farther from origin)
*
* @returns whether there is intersection
*/
CGLM_INLINE
bool
@@ -105,7 +109,6 @@ glm_ray_sphere(vec3 origin,
vec3 dp;
float r2, ddp, dpp, dscr, q, tmp, _t1, _t2;
/* ensure dir is normalized */
glm_vec3_sub(s, origin, dp);
ddp = glm_vec3_dot(dir, dp);

View File

@@ -40,6 +40,8 @@ glms_ray_(triangle)(vec3s origin,
/*!
* @brief ray sphere intersection
*
* returns false if there is no intersection if true:
*
* - t1 > 0, t2 > 0: ray intersects the sphere at t1 and t2 both ahead of the origin
* - t1 < 0, t2 > 0: ray starts inside the sphere, exits at t2
* - t1 < 0, t2 < 0: no intersection ahead of the ray
@@ -52,6 +54,8 @@ glms_ray_(triangle)(vec3s origin,
* @param[in] s sphere [center.x, center.y, center.z, radii]
* @param[in] t1 near point1 (closer to origin)
* @param[in] t2 far point2 (farther from origin)
*
* @returns whether there is intersection
*/
CGLM_INLINE
bool