Game Development Reference
In-Depth Information
min . x
+= m. m21
box . max . y ;
max . x
+= m. m21
box . min . y ;
}
i f
(m. m22 > 0 . 0 f )
{
min . y
+= m. m22
box . min . y ;
max . y
+= m. m22
box . max . y ;
}
e l s e {
min . y
+= m. m22
box . max . y ;
max . y
+= m. m22
box . min . y ;
}
i f
(m. m23 > 0 . 0 f )
{
min . z
+= m. m23
box . min . y ;
max . z
+= m. m23
box . max . y ;
}
e l s e {
min . z
+= m. m23
box . max . y ;
max . z
+= m. m23
box . min . y ;
}
(m. m31 > 0 . 0 f )
{
i f
min . x
+= m. m31
box . min . z ;
max . x
+= m. m31
box . max . z ;
}
e l s e {
min . x
+= m. m31
box . max . z ;
max . x
+= m. m31
box . min . z ;
}
i f
(m. m32 > 0 . 0 f )
{
min . y
+= m. m32
box . min . z ;
max . y
+= m. m32
box . max . z ;
}
e l s e {
min . y
+= m. m32
box . max . z ;
max . y
+= m. m32
box . min . z ;
}
i f
(m. m33 > 0 . 0 f )
{
min . z
+= m. m33
box . min . z ;
max . z
+= m. m33
box . max . z ;
}
e l s e {
min . z
+= m. m33
box . max . z ;
max . z
+= m. m33
box . min . z ;
}
}
Listing 9.4
Computing a transformed AABB
9.5
Planes
A plane is a flat, 2D subspace of 3D. Planes are extremely common tools
in video games, and the concepts in this section are especially useful. The
definition of a plane that Euclid would probably recognize is similar to
the perpendicular bisector definition of an infinite line in 2D: the set of
all points that are equidistant from two given points. This similarity in
definitions hints at the fact that planes in 3D share many properties with
infinite lines in 2D. For example, they both subdivide the space into two
“half-spaces.”
This section covers the fundamental properties of planes. Section 9.5.1
shows how to define a plane implicitly with the plane equation. Section 9.5.2
shows how three points may be used to define a plane. Section 9.5.3 de-
scribes how to find the “best-fit” plane for a set of points that may not be
exactly planar. Section 9.5.4 describes how to compute the distance from
a point to a plane.
 
Search WWH ::




Custom Search