Graphics Reference
In-Depth Information
Figure 6.13.
Finding the intersection of a ray and a
circle.
Equation (6.12) is just a fancy way of writing the solution to this system of three equa-
tions. It is easy to check that I satisfies the equations. Note that N 1 •( N 2 ¥ N 3 ) is just
the determinant of that system.
The next two problems find the intersection of a ray with a circle. We shall use
the following notation: X will denote a ray from a point p in a direction v and L will
denote the line through p with direction vector v .
6.5.7 Problem. To find the intersection q , if any, of the ray X and the circle Y with
center a and radius r.
Solution. See Figure 6.13. Now, q can be written in the form q = p + t v and so we
need to solve for t satisfying
pva
+-=
t
r,
or equivalently,
(
)
(
) =
2
pa v pa v
-+
t
-+
t
r
.
(6.13)
Let A = v v , B = ( p - a )• v , and C = ( p - a )•( p - a ) - r 2 . Equation (6.13) can be re-
written in the form
2
At
++=.
2
Bt
C
0
(6.14)
By the quadratic formula, the roots of (6.14) are
2
BB C
A
-
t
=
.
(6.15)
Note that A cannot be zero because v π 0 . That leaves three cases:
Search WWH ::




Custom Search