From 50f9681e151361fe6685582cb887818fa2092131 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Apr 2016 22:18:05 +1000 Subject: [PATCH] Docs: comment on line-sphere intersection --- source/blender/blenlib/intern/math_geom.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index e1de4617037..482709e572f 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -839,6 +839,14 @@ bool isect_seg_seg_v2_simple(const float v1[2], const float v2[2], const float v * \param l1, l2: Coordinates (point of line). * \param sp, r: Coordinate and radius (sphere). * \return r_p1, r_p2: Intersection coordinates. + * + * \note The order of assignment for intersection points (\a r_p1, \a r_p2) is predictable, + * based on the direction defined by ``l2 - l1``, + * this direction compared with the normal of each point on the sphere: + * \a r_p1 always has a >= 0.0 dot product. + * \a r_p2 always has a <= 0.0 dot product. + * For example, when \a l1 is inside the sphere and \a l2 is outside, + * \a r_p1 will always be between \a l1 and \a l2. */ int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r,