Game Development Reference
In-Depth Information
p + a n = q ,
( p + a n ) n = q n ,
p n + (a n ) n = q n ,
d + a = q n ,
a = q n − d.
Computing the signed
distance from a plane to
an arbitrary 3D point
(9.14)
9.6
Triangles
Triangles are of fundamental importance in modeling and graphics. The
surface of a complex 3D object, such as a car or a human body, is approx-
imated with many triangles. Such a group of connected triangles forms a
triangle mesh, which is the topic of Section 10.4. But before we can learn
how to manipulate many triangles, we must first learn how to manipulate
one triangle.
This section covers the fundamental properties of triangles. Section 9.6.1
introduces some notation and basic properties of triangles. Section 9.6.2
lists several methods for computing the area of a triangle in 2D or 3D. Sec-
tion 9.6.3 discusses barycentric space. Section 9.6.5 discusses a few points
on a triangle that are of special geometric significance.
9.6.1
Notation
A triangle is defined by listing its three vertices. The order that these points
are listed is significant. In a left-handed coordinate system, we typically
enumerate the points in clockwise order when viewed from the front side of
the triangle. We will refer to the three vertices as v 1 , v 2 , and v 3 .
A triangle lies in a plane, and the equation of this plane (the normal n
and distance to origin d) is important in a number of applications. We just
discussed planes, including how to compute the plane equation given three
points, in Section 9.5.2.
Let us label the interior angles, clockwise edge vectors, and side lengths
as shown in Figure 9.15.
Let l i denote the length of e i . Notice that e i and l i are opposite v i , the
vertex with the corresponding index, and are given by
e 1 = v 3 v 2 ,
e 2 = v 1 v 3 ,
e 3 = v 2 v 1 ,
Notation for edge
vectors and lengths
l 1 = e 1 ,
l 2 = e 2 ,
l 3 = e 3 .
 
Search WWH ::




Custom Search