Original Post
[source ="cpp"]#include <iostream>
#include <d3dx9.h>
using namespace std;
D3DXVECTOR3 closestPointAtPlane(D3DXVECTOR3 * point,D3DXVECTOR3 * n,float d)
{
float distance=D3DXVec3Dot(point ,n)-d;
return *point-distance*(*n);
}
main()
{
D3DXVECTOR3 point(3,6,9);
D3DXVECTOR3 n(.4838,.8062,-.1613);
float d=-42;
D3DXVECTOR3 P=closestPointAtPlane(&point,&n,d);
cout<<P<<endl;
}