Defining a plane using three points?
This adds to another thread but is for a different reason thus another thread.
Given this:
http://www.peachpit.com/articles/art...02090&seqNum=3
And this:
http://mathworld.wolfram.com/Plane.html
I'm afraid I do not understand this statement from the first link:
Quote:
Notice how we are defining the plane by three passing points. Thus, the plane is vertical, and its normal is pointing to the left side of the world, as seen from the local player position.
Since the general equation of a plane is:
ax+by+cz+d=0 or ax+by+cz=d (whichever you choose)
And the constructor options for D3DXPLANE are:
Code:
D3DXPLANE() {}
D3DXPLANE( CONST FLOAT* );
D3DXPLANE( CONST D3DXFLOAT16* );
D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d );
How do I construct a plane with only 3 points? Where is d?
EDIT:
I found the answer. Sorry.
Code:
D3DXPLANE * D3DXPlaneFromPoints(
D3DXPLANE * pOut,
CONST D3DXVECTOR3 * pV1,
CONST D3DXVECTOR3 * pV2,
CONST D3DXVECTOR3 * pV3
);
I'm going to use this to allow the AI space ships to follow waypoints, targets, and the player during battles. The code finds out which quadrant the target object is in and adjusts pitch and yaw respectively. I was going to use vector LERP but I have not converted to quaternions and using Euler's is such a PITA.
I'm using vector LERP for auto-pilot tracking and target tracking using:
Code:
void VectorLERP(D3DXVECTOR3 &result,D3DXVECTOR3 v1,D3DXVECTOR3 v2,float lerp)
{
result.x=v1.x+lerp*(v2.x-v1.x);
result.y=v1.y+lerp*(v2.y-v1.y);
result.z=v1.z+lerp*(v2.z-v1.z);
}