Table of Contents

Struct Plane

Namespace
Stride.Core.Mathematics
Assembly
Stride.Core.Mathematics.dll

Represents a plane in three dimensional space.

[DataContract]
public struct Plane : IEquatable<Plane>, IFormattable, IIntersectableWithRay
Implements

Constructors

Plane(Vector3, Vector3)

Initializes a new instance of the Plane struct.

public Plane(Vector3 point, Vector3 normal)

Parameters

point Vector3

Any point that lies along the plane.

normal Vector3

The normal vector to the plane.

Plane(Vector3, Vector3, Vector3)

Initializes a new instance of the Plane struct.

public Plane(Vector3 point1, Vector3 point2, Vector3 point3)

Parameters

point1 Vector3

First point of a triangle defining the plane.

point2 Vector3

Second point of a triangle defining the plane.

point3 Vector3

Third point of a triangle defining the plane.

Plane(Vector3, float)

Initializes a new instance of the Plane struct.

public Plane(Vector3 value, float d)

Parameters

value Vector3

The normal of the plane.

d float

The distance of the plane along its normal from the origin

Plane(float)

Initializes a new instance of the Plane struct.

public Plane(float value)

Parameters

value float

The value that will be assigned to all components.

Plane(float, float, float, float)

Initializes a new instance of the Plane struct.

public Plane(float a, float b, float c, float d)

Parameters

a float

The X component of the normal.

b float

The Y component of the normal.

c float

The Z component of the normal.

d float

The distance of the plane along its normal from the origin.

Plane(float[])

Initializes a new instance of the Plane struct.

public Plane(float[] values)

Parameters

values float[]

The values to assign to the A, B, C, and D components of the plane. This must be an array with four elements.

Exceptions

ArgumentNullException

Thrown when values is null.

ArgumentOutOfRangeException

Thrown when values contains more or less than four elements.

Fields

D

The distance of the plane along its normal from the origin.

public float D

Field Value

float

Normal

The normal vector of the plane.

public Vector3 Normal

Field Value

Vector3

Properties

this[int]

Gets or sets the component at the specified index.

public float this[int index] { get; set; }

Parameters

index int

The index of the component to access. Use 0 for the A component, 1 for the B component, 2 for the C component, and 3 for the D component.

Property Value

float

The value of the A, B, C, or D component, depending on the index.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of the range [0, 3].

Methods

Dot(Plane, Vector4)

Calculates the dot product of the specified vector and plane.

public static float Dot(Plane left, Vector4 right)

Parameters

left Plane

The source plane.

right Vector4

The source vector.

Returns

float

The dot product of the specified plane and vector.

Dot(ref readonly Plane, ref readonly Vector4, out float)

Calculates the dot product of the specified vector and plane.

public static void Dot(ref readonly Plane left, ref readonly Vector4 right, out float result)

Parameters

left Plane

The source plane.

right Vector4

The source vector.

result float

When the method completes, contains the dot product of the specified plane and vector.

DotCoordinate(Plane, Vector3)

Calculates the dot product of a specified vector and the normal of the plane plus the distance value of the plane.

public static float DotCoordinate(Plane left, Vector3 right)

Parameters

left Plane

The source plane.

right Vector3

The source vector.

Returns

float

The dot product of a specified vector and the normal of the Plane plus the distance value of the plane.

DotCoordinate(ref readonly Plane, ref readonly Vector3, out float)

Calculates the dot product of a specified vector and the normal of the plane plus the distance value of the plane.

public static void DotCoordinate(ref readonly Plane left, ref readonly Vector3 right, out float result)

Parameters

left Plane

The source plane.

right Vector3

The source vector.

result float

When the method completes, contains the dot product of a specified vector and the normal of the Plane plus the distance value of the plane.

DotNormal(Plane, Vector3)

Calculates the dot product of the specified vector and the normal of the plane.

public static float DotNormal(Plane left, Vector3 right)

Parameters

left Plane

The source plane.

right Vector3

The source vector.

Returns

float

The dot product of the specified vector and the normal of the plane.

DotNormal(ref readonly Plane, ref readonly Vector3, out float)

Calculates the dot product of the specified vector and the normal of the plane.

public static void DotNormal(ref readonly Plane left, ref readonly Vector3 right, out float result)

Parameters

left Plane

The source plane.

right Vector3

The source vector.

result float

When the method completes, contains the dot product of the specified vector and the normal of the plane.

Equals(Plane)

Determines whether the specified Vector4 is equal to this instance.

public bool Equals(Plane value)

Parameters

value Plane

The Vector4 to compare with this instance.

Returns

bool

true if the specified Vector4 is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Intersects(ref readonly BoundingBox)

Determines if there is an intersection between the current object and a BoundingBox.

public PlaneIntersectionType Intersects(ref readonly BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Intersects(ref readonly BoundingSphere)

Determines if there is an intersection between the current object and a BoundingSphere.

public PlaneIntersectionType Intersects(ref readonly BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Intersects(ref readonly Plane)

Determines if there is an intersection between the current object and a Plane.

public bool Intersects(ref readonly Plane plane)

Parameters

plane Plane

The plane to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref readonly Plane, out Ray)

Determines if there is an intersection between the current object and a Plane.

public bool Intersects(ref readonly Plane plane, out Ray line)

Parameters

plane Plane

The plane to test.

line Ray

When the method completes, contains the line of intersection as a Ray, or a zero ray if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref readonly Ray)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref readonly Ray ray)

Parameters

ray Ray

The ray to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref readonly Ray, out Vector3)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref readonly Ray ray, out Vector3 point)

Parameters

ray Ray

The ray to test.

point Vector3

When the method completes, contains the point of intersection, or Zero if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref readonly Ray, out float)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref readonly Ray ray, out float distance)

Parameters

ray Ray

The ray to test.

distance float

When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref readonly Vector3)

Determines if there is an intersection between the current object and a point.

public PlaneIntersectionType Intersects(ref readonly Vector3 point)

Parameters

point Vector3

The point to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Intersects(ref readonly Vector3, ref readonly Vector3, ref readonly Vector3)

Determines if there is an intersection between the current object and a triangle.

public PlaneIntersectionType Intersects(ref readonly Vector3 vertex1, ref readonly Vector3 vertex2, ref readonly Vector3 vertex3)

Parameters

vertex1 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triagnle to test.

vertex3 Vector3

The third vertex of the triangle to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Multiply(Plane, float)

Scales the plane by the given scaling factor.

public static Plane Multiply(Plane value, float scale)

Parameters

value Plane

The plane to scale.

scale float

The amount by which to scale the plane.

Returns

Plane

The scaled plane.

Multiply(ref readonly Plane, float, out Plane)

Scales the plane by the given scaling factor.

public static void Multiply(ref readonly Plane value, float scale, out Plane result)

Parameters

value Plane

The plane to scale.

scale float

The amount by which to scale the plane.

result Plane

When the method completes, contains the scaled plane.

Negate()

Negates a plane by negating all its coefficients, which result in a plane in opposite direction.

public void Negate()

Negate(Plane)

Negates a plane by negating all its coefficients, which result in a plane in opposite direction.

public static Plane Negate(Plane plane)

Parameters

plane Plane

The source plane.

Returns

Plane

The flipped plane.

Negate(ref readonly Plane, out Plane)

Negates a plane by negating all its coefficients, which result in a plane in opposite direction.

public static void Negate(ref readonly Plane plane, out Plane result)

Parameters

plane Plane

The source plane.

result Plane

When the method completes, contains the flipped plane.

Normalize()

Changes the coefficients of the normal vector of the plane to make it of unit length.

public void Normalize()

Normalize(Plane)

Changes the coefficients of the normal vector of the plane to make it of unit length.

public static Plane Normalize(Plane plane)

Parameters

plane Plane

The source plane.

Returns

Plane

The normalized plane.

Normalize(ref readonly Plane, out Plane)

Changes the coefficients of the normal vector of the plane to make it of unit length.

public static void Normalize(ref readonly Plane plane, out Plane result)

Parameters

plane Plane

The source plane.

result Plane

When the method completes, contains the normalized plane.

Normalize(float, float, float, float, out Plane)

Creates a plane of unit length.

public static void Normalize(float normalX, float normalY, float normalZ, float planeD, out Plane result)

Parameters

normalX float

The X component of the normal.

normalY float

The Y component of the normal.

normalZ float

The Z component of the normal.

planeD float

The distance of the plane along its normal from the origin.

result Plane

When the method completes, contains the normalized plane.

Project(Plane, Vector3)

Projects a point onto a plane.

public static Vector3 Project(Plane plane, Vector3 point)

Parameters

plane Plane

The plane to project the point to.

point Vector3

The point to project.

Returns

Vector3

The projected point.

Project(ref readonly Plane, ref readonly Vector3, out Vector3)

Projects a point onto a plane.

public static void Project(ref readonly Plane plane, ref readonly Vector3 point, out Vector3 result)

Parameters

plane Plane

The plane to project the point to.

point Vector3

The point to project.

result Vector3

The projected point.

ToArray()

Creates an array containing the elements of the plane.

public float[] ToArray()

Returns

float[]

A four-element array containing the components of the plane.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Transform(Plane, Matrix)

Transforms a normalized plane by a matrix.

public static Plane Transform(Plane plane, Matrix transformation)

Parameters

plane Plane

The normalized source plane.

transformation Matrix

The transformation matrix.

Returns

Plane

When the method completes, contains the transformed plane.

Transform(Plane, Quaternion)

Transforms a normalized plane by a quaternion rotation.

public static Plane Transform(Plane plane, Quaternion rotation)

Parameters

plane Plane

The normalized source plane.

rotation Quaternion

The quaternion rotation.

Returns

Plane

The transformed plane.

Transform(ref readonly Plane, ref readonly Matrix, out Plane)

Transforms a normalized plane by a matrix.

public static void Transform(ref readonly Plane plane, ref readonly Matrix transformation, out Plane result)

Parameters

plane Plane

The normalized source plane.

transformation Matrix

The transformation matrix.

result Plane

When the method completes, contains the transformed plane.

Transform(ref readonly Plane, ref readonly Quaternion, out Plane)

Transforms a normalized plane by a quaternion rotation.

public static void Transform(ref readonly Plane plane, ref readonly Quaternion rotation, out Plane result)

Parameters

plane Plane

The normalized source plane.

rotation Quaternion

The quaternion rotation.

result Plane

When the method completes, contains the transformed plane.

Transform(Plane[], ref readonly Matrix)

Transforms an array of normalized planes by a matrix.

public static void Transform(Plane[] planes, ref readonly Matrix transformation)

Parameters

planes Plane[]

The array of normalized planes to transform.

transformation Matrix

The transformation matrix.

Exceptions

ArgumentNullException

Thrown when planes is null.

Transform(Plane[], ref readonly Quaternion)

Transforms an array of normalized planes by a quaternion rotation.

public static void Transform(Plane[] planes, ref readonly Quaternion rotation)

Parameters

planes Plane[]

The array of normalized planes to transform.

rotation Quaternion

The quaternion rotation.

Exceptions

ArgumentNullException

Thrown when planes is null.

Operators

operator ==(Plane, Plane)

Tests for equality between two objects.

public static bool operator ==(Plane left, Plane right)

Parameters

left Plane

The first value to compare.

right Plane

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(Plane, Plane)

Tests for inequality between two objects.

public static bool operator !=(Plane left, Plane right)

Parameters

left Plane

The first value to compare.

right Plane

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(Plane, float)

Scales a plane by the given value.

public static Plane operator *(Plane plane, float scale)

Parameters

plane Plane

The plane to scale.

scale float

The amount by which to scale the plane.

Returns

Plane

The scaled plane.

operator *(float, Plane)

Scales a plane by the given value.

public static Plane operator *(float scale, Plane plane)

Parameters

scale float

The amount by which to scale the plane.

plane Plane

The plane to scale.

Returns

Plane

The scaled plane.

operator -(Plane)

Negates a plane by negating all its coefficients, which result in a plane in opposite direction.

public static Plane operator -(Plane plane)

Parameters

plane Plane

Returns

Plane

The negated plane.