Game Development Reference
In-Depth Information
primitives intersect, and (in some cases) to locate the intersection. We will
consider different two types of intersection tests: static and dynamic.
A static test checks two stationary primitives and detects whether
the two primitives intersect. It is a Boolean test—that is, it usually
returns only true (there is an intersection) or false (there is no in-
tersection). If the test returns more details about the intersection,
this extra information usually has the purpose of describing where
the intersection occurred.
A dynamic test checks two moving primitives and detects if and when
two primitives intersect. Usually, the movement is expressed paramet-
rically, and therefore the result of such a test is not only a Boolean
true/false result but also a time value (the value of the parameter t)
that indicates when the primitives intersect. For the tests that we
consider here, the movement value is a simple linear displacement—a
vector offset by which the primitive moves as t varies from 0 to 1.
Although each object may have its own displacement over the time in-
terval under consideration, it will be often easier to view the problem
from the point of view of one of the primitives, considering that prim-
itive to be “still” while the other primitive does all of the “moving.”
We can easily do this by combining the two displacement vectors to
get a single relative displacement vector that describes how the two
primitives move in relation to each other. Thus, the dynamic tests will
usually involve one stationary primitive and one moving primitive.
Notice that many important tests involving rays are actually dynamic
tests, since a ray can be viewed as a moving point.
A.7
Intersection of Two Implicit Lines in 2D
Finding the intersection of two lines defined implicitly in 2D is a straightfor-
ward matter of solving a system of linear equations. We have two equations
(the two implicit equations of the lines) and two unknowns (the x- and y-
coordinates of the point of intersection). Our two equations are
a 1 x + b 1 y = d 1 ,
a 2 x + b 2 y = d 2 .
Solving this system of equations yields
x = b 2 d 1
− b 1 d 2
a 1 b 2 − a 2 b 1 ,
y = a 1 d 2
Computing the
intersection of two lines
in 2D
(A.3)
− a 2 d 1
a 1 b 2 − a 2 b 1 .
Search WWH ::




Custom Search