Skip to content

Plane

A plane defined by a normal vector and a distance from the origin.

The plane equation is defined as: dot(normal, point) + distance = 0. Used in collision tests, frustum culling, and geometry classification.

Properties

distance float

cpp
float distance { 0.0f }

The signed distance from the origin to the plane along the normal.

normal Vector3

cpp
Vector3 normal { Vector3::Up() }

The normal vector of the plane, pointing outward.

Functions

DistanceToPoint() auto

cpp
auto vglx::Plane::DistanceToPoint(const Vector3 &point) const
ParameterDescription
pointThe point to measure.

Returns the signed distance from a point to the plane. Positive values mean the point is in front of the plane (in the direction of the normal), negative values mean it's behind.

DistanceToSphere() auto

cpp
auto vglx::Plane::DistanceToSphere(const Sphere &sphere) const
ParameterDescription
sphereThe sphere to measure.

Returns the signed distance from a sphere to the plane. A negative result means the sphere intersects or is behind the plane.

Normalize() auto

cpp
auto vglx::Plane::Normalize()

Normalizes the plane equation. Ensures the normal is unit length and adjusts the distance accordingly.

Plane() constexpr

cpp
vglx::Plane::Plane(const Vector3 &normal, float distance)
ParameterDescription
normalNormal vector of the plane.
distanceSigned distance from the origin.

Constructs a Plane from a normal vector and distance.

Released under the MIT License.