MSDN Documentation – DirectX

Plane Structure

Overview

The Plane structure defines a plane in three‑dimensional space. It is commonly used for frustum culling, collision detection, and defining clipping boundaries.

Syntax

struct Plane
{
    float a;  // X component of the normal vector
    float b;  // Y component of the normal vector
    float c;  // Z component of the normal vector
    float d;  // Distance from the origin (negative dot product)
};

Members

MemberTypeDescription
afloatX component of the normal vector.
bfloatY component of the normal vector.
cfloatZ component of the normal vector.
dfloatDistance from the origin (plane equation: ax + by + cz + d = 0).

Remarks

  • The normal vector (a, b, c) should be normalized for accurate distance calculations.
  • Positive d values place the plane on the opposite side of the normal direction.
  • Use the XMPlaneNormalize helper to ensure the plane is unit‑length.

Example

Creating a plane from three points using DirectXMath:

#include <DirectXMath.h>
using namespace DirectX;

// Points defining the plane
XMFLOAT3 p0(0.0f, 0.0f, 0.0f);
XMFLOAT3 p1(1.0f, 0.0f, 0.0f);
XMFLOAT3 p2(0.0f, 1.0f, 0.0f);

// Convert to XMVECTOR
XMVECTOR v0 = XMLoadFloat3(&p0);
XMVECTOR v1 = XMLoadFloat3(&p1);
XMVECTOR v2 = XMLoadFloat3(&p2);

// Compute the plane
XMVECTOR plane = XMPlaneFromPoints(v0, v1, v2);
XMFLOAT4 planeF;
XMStoreFloat4(&planeF, plane);

// planeF now holds {a, b, c, d}

See Also