Graphics Reference
In-Depth Information
B
2
Case 1:
- AC = 0: The line
L
will intersect the circle in a single point and is
tangent to it there. If t ≥ 0, then the ray also intersects the circle
at that point.
B
2
Case 2:
- AC < 0: Both the line
L
and the ray miss the circle.
B
2
Case 3:
- AC > 0: The line
L
intersects the circle in two points. Let t
1
and t
2
be the two distinct solutions to equation (6.13) with t
1
< t
2
.
If t
1
≥ 0, then the ray intersects the circle in two points. If
t
1
< 0 £ t
2
, then the ray intersects the circle in one point. Finally,
if t
2
< 0, then the ray misses the circle.
A special case of Problem 6.5.7 is
6.5.8 Problem.
To find the intersection
q
, if any, of the ray
X
and the circle
Y
with
radius r centered at the origin.
Solution.
In this case we need to solve for t satisfying
p
+=
t
r,
or equivalently,
2
2
2
(
)
+-=
2
v
t
+
2
p
•
v
t
p
r
0
.
It follows that
(
)
2
2
2
-
(
)
±
(
)
2
pv
•
pv
•
-
v p
-
r
t
=
.
(6.16)
2
v
The three cases in Problem 6.5.7 reduce to
(
p
•
v
)
2
-|
v
|
2
(|
p
|
2
- r
2
) = 0
Case 1:
(
p
•
v
)
2
-|
v
|
2
(|
p
|
2
- r
2
) < 0
Case 2:
(
p
•
v
)
2
-|
v
|
2
(|
p
|
2
- r
2
) > 0
Case 3:
with the same answers as before.
6.6
Distance Formulas
The next two sections describe a number of formulas that are handy for applications.
6.6.1 Formula.
Let
L
be a line defined by a point
Q
and direction vector
v
and let
P
be a point. The point