Game Development Reference
In-Depth Information
In Figure 12 we see that the graph of a plane is all the points p that sat-
isfy the equation.
0
(7)
n
p
p
0
Figure 12: If p 0 is a point on the plane, then
the point p is also on the plane if the vector
formed from ( p - p 0 ) is orthogonal to the
plane's normal vector.
When describing a particular plane, the normal n and a known point on
the plane p 0 are fixed, so it is typical to write equation (7) as:
n
p
d
0
(8)
where d =- n p 0 .
Note:
If the plane's normal vector n is of unit length, d =- n
p 0
gives the shortest signed distance from the origin to the plane.
D3DXPLANE
When representing a plane in code, it suffices to store only the normal
vector n and the constant d . It is useful to think of this as a 4D vector,
which we denote as ( n , d ). The D3DX library uses the following struc-
ture for a plane:
typedef struct D3DXPLANE
{
#ifdef __cplusplus
public:
D3DXPLANE() {}
D3DXPLANE( CONST FLOAT* );
D3DXPLANE( CONST D3DXFLOAT16* );
D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d );
// casting
operator FLOAT* ();
operator CONST FLOAT* () const;
// unary operators
D3DXPLANE operator + () const;
D3DXPLANE operator - () const;
// binary operators
BOOL operator == ( CONST D3DXPLANE& ) const;
BOOL operator != ( CONST D3DXPLANE& ) const;
Search WWH ::




Custom Search