I write a test program for the function ON_Intersect( const ON_Line&, const ON_Sphere&, ON_3dPoint&, ON_3dPoint& ) using RhinoSDK, I find that when the Line do not intersect with the
sphere, there are also intersections. Can you give me some advices to solve the problem?

The way
int ON_Interesect(
const ON_Line&,
const ON_Sphere&,
ON_3dPoint&,
ON_3dPoint& )

works is described in the header file comments for the functionâ€™s declaration.

// returns 0 = no intersections,
// 1 = one intersection,
// 2 = 2 intersections
// If 0 is returned, first point is the point
// on line closest to sphere and 2nd point is the point
// on the sphere closest to the line.
// If 1 is returned, first point is obtained by evaluating
// the line and the second point is obtained by evaluating
// the sphere.

In the code you posted, you need to look at the value of â€śnumâ€ť to determine what the output values mean.

When num=0, the line and sphere do not intersect. The returned â€śAâ€ť = the point on the line that is closest to the sphere and â€śBâ€ť = the point on the sphere that is closest to the line.

If this does not help, please add Rhino .3dm file to your reply using the button on the top toolbar that looks like a cloud with an up arrow in it. The button tool tip will say â€śimageâ€ť, but you can use it to attach any type of file.