mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 17:09:40 +00:00
docs: ray sphere docs improvements
This commit is contained in:
@@ -36,6 +36,8 @@ Functions documentation
|
|||||||
|
|
||||||
ray sphere intersection
|
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 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: ray starts inside the sphere, exits at t2
|
||||||
- t1 < 0, t2 < 0: no intersection ahead of the ray
|
- t1 < 0, t2 < 0: no intersection ahead of the ray
|
||||||
|
@@ -82,6 +82,8 @@ glm_ray_triangle(vec3 origin,
|
|||||||
/*!
|
/*!
|
||||||
* @brief ray sphere intersection
|
* @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 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: ray starts inside the sphere, exits at t2
|
||||||
* - t1 < 0, t2 < 0: no intersection ahead of the ray
|
* - 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] s sphere [center.x, center.y, center.z, radii]
|
||||||
* @param[in] t1 near point1 (closer to origin)
|
* @param[in] t1 near point1 (closer to origin)
|
||||||
* @param[in] t2 far point2 (farther from origin)
|
* @param[in] t2 far point2 (farther from origin)
|
||||||
|
*
|
||||||
|
* @returns whether there is intersection
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
bool
|
bool
|
||||||
@@ -105,7 +109,6 @@ glm_ray_sphere(vec3 origin,
|
|||||||
vec3 dp;
|
vec3 dp;
|
||||||
float r2, ddp, dpp, dscr, q, tmp, _t1, _t2;
|
float r2, ddp, dpp, dscr, q, tmp, _t1, _t2;
|
||||||
|
|
||||||
/* ensure dir is normalized */
|
|
||||||
glm_vec3_sub(s, origin, dp);
|
glm_vec3_sub(s, origin, dp);
|
||||||
|
|
||||||
ddp = glm_vec3_dot(dir, dp);
|
ddp = glm_vec3_dot(dir, dp);
|
||||||
|
@@ -40,6 +40,8 @@ glms_ray_(triangle)(vec3s origin,
|
|||||||
/*!
|
/*!
|
||||||
* @brief ray sphere intersection
|
* @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 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: ray starts inside the sphere, exits at t2
|
||||||
* - t1 < 0, t2 < 0: no intersection ahead of the ray
|
* - 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] s sphere [center.x, center.y, center.z, radii]
|
||||||
* @param[in] t1 near point1 (closer to origin)
|
* @param[in] t1 near point1 (closer to origin)
|
||||||
* @param[in] t2 far point2 (farther from origin)
|
* @param[in] t2 far point2 (farther from origin)
|
||||||
|
*
|
||||||
|
* @returns whether there is intersection
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
bool
|
bool
|
||||||
|
Reference in New Issue
Block a user