Game Development Reference
In-Depth Information
produce a scalar. The dot product is a very common operation in 3D graphics, so
common the multiply operator * is often overloaded to represent it.
public double DotProduct(Vector v)
{
return (v.X * X) + (Y * v.Y) + (Z * v.Z);
}
public static double operator *(Vector v1, Vector v2)
{
return v1.DotProduct(v2);
}
Dot products are great for determining if a point is behind or in front of a
plane. A plane is a two-dimensional surface, like a piece of paper. A piece of
paper can be positioned and angled anywhere just like a geometric plane.
The difference is that a piece of paper has an edge. Planes don't have edges;
they keep going infinitely along their two dimensions—a piece of paper
without end! A plane is defined using a point and a normalized vector. (See
Figure 8.14.) The point positions the plane in space and the normal specifies
the direction it's pointing.
Figure 8.14
A plane.
 
Search WWH ::




Custom Search