Computes the equation of a plane constructed from three points in the plane.
XMVECTOR XMPlaneFromPoints(
XMVECTOR Point1,
XMVECTOR Point2,
XMVECTOR Point3
)
Point1
Type: XMVECTOR
3D vector describing a point in the plane.
Point2
Type: XMVECTOR
3D vector describing a point in the plane.
Point3
Type: XMVECTOR
3D vector describing a point in the plane.
Type: XMVECTOR
Returns a vector whose components are the coefficients of the plane (A, B, C, D) for the plane equation
XMVECTOR Result;
XMVECTOR N;
XMVECTOR D;
XMVECTOR V21 = XMVectorSubtract(Point1, Point2);
XMVECTOR V31 = XMVectorSubtract(Point1, Point3);
N = XMVector3Cross(V21, V31);
N = XMVector3Normalize(N);
D = XMPlaneDotNormal(N, Point1);
Result.x = N.x;
Result.y = N.y;
Result.z = N.z;
Result.w = -D.w;
return Result;
.
The following pseudocode demonstrates the operation of the function:
Ax+By+Cz+D=0
Header: Declared in directxmath.h.