reckfellENGINE

Plane

A plane Normal.Dot(point) = D with an oriented normal.

On this page
struct PlaneReckfellSharpInherits ValueType

Metric DistanceTo and correct Project require a unit normal. Plane(normal,d) does not normalize input automatically; Normalized rescales both Normal and D. A zero normal does not define a geometric plane.

Keep an operation in one coordinate space. IntersectsRay/IntersectsSegment return a nullable point; check for a result. These calculations do not query world colliders or layers. Three-point constructor order affects normal orientation.

Practical guide.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors5

Plane5 overloads
# Plane · 1/5
C#
public Plane(Vector3 normal);

Stores normal and sets D = 0: with a nonzero normal the plane passes through the origin. Does not normalize automatically; a zero normal does not define a plane.

Parameters
NameTypeDefault
normalVector3—
normal

Nonzero normal in the chosen coordinate system; use a unit vector for metric methods.

# Plane · 2/5
C#
public Plane(Vector3 normal, Vector3 point);

Stores normal and computes D = normal.Dot(point). Does not normalize the normal automatically. For metric distances and orthogonal projection, supply a unit normal or call Normalized() on the result.

Parameters
NameTypeDefault
normalVector3—
pointVector3—
normal

Nonzero normal in the chosen coordinate system; use a unit vector for metric methods.

point

Point on the plane in the same coordinate system.

# Plane · 3/5
C#
public Plane(Vector3 v1, Vector3 v2, Vector3 v3);

Builds Normal = Normalize((v1 - v3).Cross(v1 - v2)) and D = Normal.Dot(v1). Point order determines normal orientation; swapping two points flips it. Coincident or collinear points produce a zero normal, not a valid geometric plane.

Parameters
NameTypeDefault
v1Vector3—
v2Vector3—
v3Vector3—
v1

First of three noncollinear points.

v2

Second point in the same coordinate system.

v3

Third point; ordering affects normal orientation.

# Plane · 4/5
C#
public Plane(Vector3 normal, float d);

Stores the coefficients of Normal.Dot(x) = D without normalization. For example, Normal = (0, 1, 0), D = 2 means y = 2. D can be negative. Metric operations require a unit normal.

Parameters
NameTypeDefault
normalVector3—
dfloat—
normal

Nonzero normal in the chosen coordinate system; use a unit vector for metric methods.

d

Right-hand side of Normal.Dot(x) = D; a signed offset along the normal when it is a unit vector.

# Plane · 5/5
C#
public Plane(float a, float b, float c, float d);

Stores the coefficients of Normal.Dot(x) = D without normalization. For example, Normal = (0, 1, 0), D = 2 means y = 2. D can be negative. Metric operations require a unit normal.

Parameters
NameTypeDefault
afloat—
bfloat—
cfloat—
dfloat—
a

Normal X component.

b

Normal Y component.

c

Normal Z component.

d

Right-hand side of Normal.Dot(x) = D; a signed offset along the normal when it is a unit vector.

Properties8

DProperty
# D
C#
public float D { get; set; }

Right-hand side of Normal.Dot(x) = D. With a unit normal, it is the signed offset from the origin along Normal; negative values are valid. Assignment changes only D. With a nonunit normal, D alone is not a distance.

NormalProperty
# Normal
C#
public Vector3 Normal { get; set; }

Coefficients (a, b, c) of ax + by + cz = D. Assignment neither normalizes the vector nor changes D. To edit a component, use X, Y, Z or assign the whole Normal vector. Changing the normal while preserving D can change the geometric plane.

PlaneXYProperty
# PlaneXY
C#
public static Plane PlaneXY { get; }

Coordinate plane z = 0 with Normal = (0, 0, 1) and D = 0. Its normal points along +Z. Returns a Plane value: editing a copy stored in a variable does not modify this static plane.

PlaneXZProperty
# PlaneXZ
C#
public static Plane PlaneXZ { get; }

Coordinate plane y = 0 with Normal = (0, 1, 0) and D = 0. Its normal points along +Y. Returns a Plane value: editing a copy stored in a variable does not modify this static plane.

PlaneYZProperty
# PlaneYZ
C#
public static Plane PlaneYZ { get; }

Coordinate plane x = 0 with Normal = (1, 0, 0) and D = 0. Its normal points along +X. Returns a Plane value: editing a copy stored in a variable does not modify this static plane.

XProperty
# X
C#
public float X { get; set; }

Alias for Normal.X. Assignment changes only this normal component without normalization or recalculating D.

YProperty
# Y
C#
public float Y { get; set; }

Alias for Normal.Y. Assignment changes only this normal component without normalization or recalculating D.

ZProperty
# Z
C#
public float Z { get; set; }

Alias for Normal.Z. Assignment changes only this normal component without normalization or recalculating D.

Methods20

DistanceTofloat
# DistanceTo
C#
public float DistanceTo(Vector3 point);

Returns Normal.Dot(point) − D. It is signed geometric distance only for a unit normal in a matching coordinate space.

Parameters
NameTypeDefault
pointVector3—
point

Point in the plane coordinate system.

Returns float

Normal.Dot(point) - D: positive on the Normal side and negative on the other side. A metric distance only with a unit normal.

Equals2 overloads
# Equals · 1/2
C#
public bool Equals(Plane other);

Compares Normal and D exactly without normalization or equating opposite normals. p, -p and Plane(p.Normal * 2, p.D * 2) can describe the same point set but have unequal coefficients.

Parameters
NameTypeDefault
otherPlane—
other

Other plane for exact coefficient comparison.

Returns bool

true for exactly equal coefficients.

# Equals · 2/2
C#
public override bool Equals(object? obj);

Compares Normal and D exactly without normalization or equating opposite normals. p, -p and Plane(p.Normal * 2, p.D * 2) can describe the same point set but have unequal coefficients. For obj, accepts only a boxed Plane; null and other types return false.

Parameters
NameTypeDefault
objobject—
obj

Object to compare; null is allowed.

Returns bool

true for exactly equal coefficients.

GetCenterVector3
# GetCenter
C#
public Vector3 GetCenter();

Returns Normal * D. This is the closest plane point to the origin only for a unit normal. Does not divide by squared normal length or normalize input. For example, Plane((0, 2, 0), 4) gives (0, 8, 0), although the equation means y = 2; call Normalized() first.

Returns Vector3

Normal * D. An infinite plane has no bounded intrinsic center.

GetHashCodeint
# GetHashCode
C#
public override int GetHashCode();

Returns HashCode.Combine(Normal, D). Exactly equal coefficients have equal hashes, but a matching hash does not prove equality. By default, Dictionary<Plane, T> uses exact Equals(), not geometric coincidence. Do not persist the hash as an identifier across runs.

Returns int

The hash of Normal and D coefficients.

HasPointbool
# HasPoint
C#
public bool HasPoint(Vector3 point, float tolerance = 1E-06f);

Tests abs(Normal.Dot(point) - D) <= tolerance, including the tolerance boundary. Tolerance measures the equation residual and corresponds to distance only for a unit normal. A negative tolerance rejects even zero residual. A zero normal with D = 0 can accept any finite point and is not a valid plane.

Parameters
NameTypeDefault
pointVector3—
tolerancefloat1E-06f
point

Finite point in the plane coordinate system.

tolerance

Nonnegative equation-residual tolerance; defaults to 0.000001 in the current float SDK.

Returns bool

true when the absolute residual is at most tolerance.

Intersect3Vector3?
# Intersect3
C#
public Vector3? Intersect3(Plane b, Plane c);

Finds the unique common point of this plane, b and c. The denominator is Normal.Cross(b.Normal).Dot(c.Normal); returns null when Mathf.IsZeroApprox treats it as zero. Both no intersection and no unique point use this result. The threshold is absolute: small coefficient scale can yield null even for independent normals. Use finite normalized planes for geometric calculations.

Parameters
NameTypeDefault
bPlane—
cPlane—
b

Second plane in the same coordinate system.

c

Third plane in the same coordinate system.

Returns Vector3?

The unique common point, or null for an approximately zero determinant.

IntersectsRayVector3?
# IntersectsRay
C#
public Vector3? IntersectsRay(Vector3 from, Vector3 dir);

Returns Vector3? for the ray from + dir × t intersecting the plane, or null. An approximately parallel ray returns null, including a coplanar ray. Hits behind the origin are rejected with a Mathf.Epsilon tolerance in parameter t.

Parameters
NameTypeDefault
fromVector3—
dirVector3—
from

Ray origin in the plane coordinate space.

dir

Nonzero direction; use a unit vector so the parameter tolerance corresponds to distance.

Returns Vector3?

Intersection point or null; check HasValue before Value. The operation does not query colliders.

IntersectsSegmentVector3?
# IntersectsSegment
C#
public Vector3? IntersectsSegment(Vector3 begin, Vector3 end);

Finds the intersection of the finite begin–end segment with the mathematical plane. Returns null for approximately zero Normal.Dot(begin - end), including coplanar or zero-length segments. For a nonparallel segment, accepts parameter t from -Mathf.Epsilon through 1 + Mathf.Epsilon. This tolerance is a fraction of segment length; the result is not clamped to endpoints and can lie slightly beyond them. Check HasValue before Value. This calculation does not query colliders.

C#
using Reckfell;

public static class PlaneExamples
{
    public static bool Validate()
    {
        var floor = new Plane(Vector3.Up, 2); // y = 2
        Vector3? hit = floor.IntersectsRay(new Vector3(0, 10, 0), Vector3.Down);
        Vector3? segmentHit = floor.IntersectsSegment(new Vector3(0, 5, 0), Vector3.Zero);
        Vector3 projected = floor.Project(new Vector3(3, 9, 4));
        return hit.HasValue && hit.Value.IsEqualApprox(new Vector3(0, 2, 0))
            && segmentHit.HasValue && segmentHit.Value.IsEqualApprox(new Vector3(0, 2, 0))
            && projected.IsEqualApprox(new Vector3(3, 2, 4));
    }
}
Parameters
NameTypeDefault
beginVector3—
endVector3—
begin

Segment start in the plane coordinate system.

end

Segment endpoint, not a direction.

Returns Vector3?

The intersection point, or null under the denominator and parameter-range rules.

IsEqualApproxbool
# IsEqualApprox
C#
public bool IsEqualApprox(Plane other);

Compares Normal and D componentwise using Mathf.IsEqualApprox(). Does not normalize coefficients or treat opposite normals as equal. In the current float SDK, exact equality succeeds immediately; otherwise abs(a - b) < max(0.000001, 0.000001 * abs(a)) is required, with a from this plane. This is not geometric plane equality; it is nontransitive and can depend on operand order at the tolerance boundary.

Parameters
NameTypeDefault
otherPlane—
other

Plane whose coefficients are compared without prior normalization.

Returns bool

true when all four approximate comparisons pass.

IsFinitebool
# IsFinite
C#
public bool IsFinite();

Checks Normal and D for NaN and infinities. Does not validate normal length: default(Plane) has finite zero coefficients but does not define a geometric plane. Metric operations additionally require a nonzero unit normal.

Returns bool

true when all four coefficients are finite.

IsPointOverbool
# IsPointOver
C#
public bool IsPointOver(Vector3 point);

Tests the strict comparison Normal.Dot(point) > D. For a valid plane, true means the side toward which the normal points. A point on the plane returns false; no tolerance is applied. This refers to normal orientation, not necessarily world +Y.

Parameters
NameTypeDefault
pointVector3—
point

Finite point in the same coordinate system.

Returns bool

true for a positive equation residual.

NormalizedPlane
# Normalized
C#
public Plane Normalized();

Divides both Normal and D by nonzero normal length, preserving the plane. Normalizing only Normal would change its position.

Returns Plane

For a nonzero normal, divides Normal and D by its length. A zero normal returns a Plane with zero Normal and D; this is not a geometric plane.

ProjectVector3
# Project
C#
public Vector3 Project(Vector3 point);

Projects onto a known plane with a unit normal. Does not query physics; point and plane must share a space.

Parameters
NameTypeDefault
pointVector3—
point

Finite point in the plane coordinate system; normalize the plane first.

Returns Vector3

point - Normal * DistanceTo(point). An orthogonal projection onto the plane when the normal is unit length.

ToString2 overloads
# ToString · 1/2
C#
public override string ToString();

Builds Normal.ToString(format) + ", " + D.ToString(format, InvariantCulture). For example, F2 gives (0.00, 1.00, 0.00), 2.00. The format applies to all four coefficients. This is diagnostic text, not a save format. Equivalent to ToString(null).

Returns string

Text containing the normal and D with culture-independent numeric formatting.

# ToString · 2/2
C#
public string ToString(string? format);

Builds Normal.ToString(format) + ", " + D.ToString(format, InvariantCulture). For example, F2 gives (0.00, 1.00, 0.00), 2.00. The format applies to all four coefficients. This is diagnostic text, not a save format. An invalid numeric format can throw FormatException.

Parameters
NameTypeDefault
formatstring—
format

A .NET numeric format such as "F2"; null selects the default format.

Returns string

Text containing the normal and D with culture-independent numeric formatting.

op_Equalitybool
# op_Equality
C#
public static bool operator ==(Plane left, Plane right);

Compares Normal and D exactly without normalization or equating opposite normals. p, -p and Plane(p.Normal * 2, p.D * 2) can describe the same point set but have unequal coefficients.

Parameters
NameTypeDefault
leftPlane—
rightPlane—
left

Left plane.

right

Right plane.

Returns bool

true for exactly equal coefficients.

op_Inequalitybool
# op_Inequality
C#
public static bool operator !=(Plane left, Plane right);

Compares Normal and D exactly without normalization or equating opposite normals. p, -p and Plane(p.Normal * 2, p.D * 2) can describe the same point set but have unequal coefficients. Operator != negates exact equality.

Parameters
NameTypeDefault
leftPlane—
rightPlane—
left

Left plane.

right

Right plane.

Returns bool

true for unequal coefficients.

op_UnaryNegationPlane
# op_UnaryNegation
C#
public static Plane operator -(Plane plane);

Returns Plane(-Normal, -D): preserves geometric location while reversing normal orientation and DistanceTo signs. Negating only Normal while preserving D is a different transformation.

Parameters
NameTypeDefault
planePlane—
plane

Input plane.

Returns Plane

A value copy with negated Normal and D.

op_UnaryPlusPlane
# op_UnaryPlus
C#
public static Plane operator +(Plane plane);

Returns the unchanged Plane value. Does not normalize coefficients or change their signs.

Parameters
NameTypeDefault
planePlane—
plane

Input plane.

Returns Plane

A value copy with unchanged coefficients.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.