Circle-Line Intersection -- from Wolfram MathWorld This is a very accurate equation the traditional method of solving by quadriatic equation does not work . It provides very ambiguoys values. But this one worked as I programmed it in C ++. Please help me with how this was derived.
I shall be highly grateful to whosoever is ready to guide me on this.
Do you have an example of whatever you are claiming “does not work” (or what you mean by ambiguous values)? What is the “this” whose derivation you are asking about?
As currently posed, there is not a viable Wolfram Technologies related question in here, at least that I can discern.
A vector geometry approach may be helpful.
Let C be the circle center, r its radius.
Let P be a point on the line v, a unit vector in the direction of the line.
First, project C onto the line giving point Q l = (C - P).v, Q = P + l v.
Then compute the distance of C from the line d = ||(C - Q)||
If this distance d = r, then Q is the tangent point.
If this distance d > r, then there are no real intersection points.
Else, the distance of the intersection points from Q are found using Pythagoras. b = sqrt(r^2 - d^2)
then the two intersection points are given by:
ip1 = Q + bv, ip2 = Q - bv.