Find the intersection points of the parametric line given by the equations:
x = x1 + (x2 − x1)t |
y = y1 + (y2 − y1)t |
z = z1 + (z2 − z1)t |
and the sphere given by the equation: |
(x − xc)2 +(y − yc)2 + (z − zc)2 = r2 |
Because the intersection points of the parametric equations should satisfy the sphere equation we will substitute the values of x y and z of the parametric equations into the sphere equation:
[(x2 − x1)t − (xc − x1)]2 ⧾ [(y2 − y1)t − (yc − y1)]2 ⧾ [(z2 − z1)t − (zc − z1)]2 = r2
Now we will find the square values of the parenthesis.
(x2 − x1)2t2 − 2t(x2 − x1)(xc − x1) + (xc − x1)2 + (y2 − y1)2t2 − 2t(y2 − y1)(yc − y1) + (yc − y1)2 + (z2 − z1)2t2 − 2t(z2 − z1)(zc − z1) + (zc − z1)2 − r2 = 0
Arranging the expression received as a powers of t we get:
t2[(x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2] − |
2t[(x2 − x1)(xc − x1) + (y2 − y1)(yc − y1) + (z2 − z1)(zc − z1)] + |
(xc − x1)2 + (yc − y1)2 + (zc − z1)2 − r2 = 0 |
And we got a quadratic equation of the form: at2 + bt + c = 0
Where: |
a = (x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2 |
| b = − 2[(x2 − x1)(xc − x1) + (y2 − y1)(yc − y1) + (z2 − z1)(zc − z1)] |
| c = (xc − x1)2 + (yc − y1)2 + (zc − z1)2 − r2 |
The solution for t is: |
|
Substitute this values of t into the parametric line equations to get the intersection points.
|