Game Development Reference
In-Depth Information
Appendix A
Geometric Tests
Chapter 9 discussed a number of calculations that can be performed on
a single primitive. Here, we present a number of useful calculations that
operate on more than one primitive. This appendix is a collection of various
geometric calculations that are sometimes useful. It is also instructive to
browse these tests, because many illustrate general principles.
A more comprehensive list of fast intersection methods can be found at
A.1
Closest Point on 2D Implicit Line
Consider an infinite line L in 2D defined implicitly by all points
p
such that
p
n
= d,
where
n
is a unit vector. Our goal is to find, for any point
q
, the point
q
′
that is the closest point on L to
q
. This is the result of projecting
q
onto L. Let us draw a second line M through
q
, parallel to L, as shown in
Figure A.1.
Figure A.1
Finding the closest point on a 2D implicit line
717
Search WWH ::
Custom Search