Plane Struct
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Represents a plane in three dimensional space.
[DataContract]
public struct Plane : IEquatable<Plane>, IFormattable, IIntersectableWithRay
Name | Description | |
---|---|---|
Constructors | ||
Plane(Vector3, Vector3) | Initializes a new instance of the Plane struct. |
|
Plane(Vector3, Vector3, Vector3) | Initializes a new instance of the Plane struct. |
|
Plane(Vector3, Single) | Initializes a new instance of the Plane struct. |
|
Plane(Single) | Initializes a new instance of the Plane struct. |
|
Plane(Single, Single, Single, Single) | Initializes a new instance of the Plane struct. |
|
Plane(Single[]) | Initializes a new instance of the Plane struct. |
|
Fields | ||
D | The distance of the plane along its normal from the origin. |
|
Normal | The normal vector of the plane. |
|
Properties | ||
Item[Int32] | Gets or sets the component at the specified index. |
|
Methods | ||
Dot(Plane, Vector4) | Calculates the dot product of the specified vector and plane. |
|
Dot(ref Plane, ref Vector4, out Single) | Calculates the dot product of the specified vector and plane. |
|
DotCoordinate(Plane, Vector3) | Calculates the dot product of a specified vector and the normal of the plane plus the distance value of the plane. |
|
DotCoordinate(ref Plane, ref Vector3, out Single) | Calculates 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. |
|
DotNormal(ref Plane, ref Vector3, out Single) | Calculates 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. |
|
Equals(Object) | Determines whether the specified System.Object is equal to this instance. |
|
GetHashCode() | Returns a hash code for this instance. |
|
Intersects(ref BoundingBox) | Determines if there is an intersection between the current object and a BoundingBox. |
|
Intersects(ref BoundingSphere) | Determines if there is an intersection between the current object and a BoundingSphere. |
|
Intersects(ref Plane) | Determines if there is an intersection between the current object and a Plane. |
|
Intersects(ref Plane, out Ray) | Determines if there is an intersection between the current object and a Plane. |
|
Intersects(ref Ray) | Determines if there is an intersection between the current object and a Ray. |
|
Intersects(ref Ray, out Vector3) | Determines if there is an intersection between the current object and a Ray. |
|
Intersects(ref Ray, out Single) | Determines if there is an intersection between the current object and a Ray. |
|
Intersects(ref Vector3) | Determines if there is an intersection between the current object and a point. |
|
Intersects(ref Vector3, ref Vector3, ref Vector3) | Determines if there is an intersection between the current object and a triangle. |
|
Multiply(Plane, Single) | Scales the plane by the given scaling factor. |
|
Multiply(ref Plane, Single, out Plane) | Scales the plane by the given scaling factor. |
|
Negate() | Negates a plane by negating all its coefficients, which result in a plane in opposite direction. |
|
Negate(Plane) | Negates a plane by negating all its coefficients, which result in a plane in opposite direction. |
|
Negate(ref Plane, out Plane) | Negates a plane by negating all its coefficients, which result in a plane in opposite direction. |
|
Normalize() | Changes the coefficients of the normal vector of the plane to make it of unit length. |
|
Normalize(Plane) | Changes the coefficients of the normal vector of the plane to make it of unit length. |
|
Normalize(ref Plane, out Plane) | Changes the coefficients of the normal vector of the plane to make it of unit length. |
|
Normalize(Single, Single, Single, Single, out Plane) | Creates a plane of unit length. |
|
Project(Plane, Vector3) | Projects a point onto a plane. |
|
Project(ref Plane, ref Vector3, out Vector3) | Projects a point onto a plane. |
|
ToArray() | Creates an array containing the elements of the plane. |
|
ToString() | Returns a System.String that represents this instance. |
|
ToString(IFormatProvider) | Returns a System.String that represents this instance. |
|
ToString(String) | Returns a System.String that represents this instance. |
|
ToString(String, IFormatProvider) | Returns a System.String that represents this instance. |
|
Transform(Plane, Matrix) | Transforms a normalized plane by a matrix. |
|
Transform(Plane, Quaternion) | Transforms a normalized plane by a quaternion rotation. |
|
Transform(ref Plane, ref Matrix, out Plane) | Transforms a normalized plane by a matrix. |
|
Transform(ref Plane, ref Quaternion, out Plane) | Transforms a normalized plane by a quaternion rotation. |
|
Transform(Plane[], ref Matrix) | Transforms an array of normalized planes by a matrix. |
|
Transform(Plane[], ref Quaternion) | Transforms an array of normalized planes by a quaternion rotation. |
|
Operators | ||
Equality(Plane, Plane) | Tests for equality between two objects. |
|
Inequality(Plane, Plane) | Tests for inequality between two objects. |
|
Multiply(Plane, Single) | Scales a plane by the given value. |
|
Multiply(Single, Plane) | Scales a plane by the given value. |
|
UnaryNegation(Plane) | Negates a plane by negating all its coefficients, which result in a plane in opposite direction. |
Constructors
Plane(Vector3, Vector3)
Initializes a new instance of the Plane struct.
public Plane(Vector3 point, Vector3 normal)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | Any point that lies along the plane. |
Vector3 | normal | 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
Type | Name | Description |
---|---|---|
Vector3 | point1 | First point of a triangle defining the plane. |
Vector3 | point2 | Second point of a triangle defining the plane. |
Vector3 | point3 | Third point of a triangle defining the plane. |
Plane(Vector3, Single)
Initializes a new instance of the Plane struct.
public Plane(Vector3 value, float d)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The normal of the plane. |
System.Single | d | The distance of the plane along its normal from the origin |
Plane(Single)
Initializes a new instance of the Plane struct.
public Plane(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | The value that will be assigned to all components. |
Plane(Single, Single, Single, Single)
Initializes a new instance of the Plane struct.
public Plane(float a, float b, float c, float d)
Parameters
Type | Name | Description |
---|---|---|
System.Single | a | The X component of the normal. |
System.Single | b | The Y component of the normal. |
System.Single | c | The Z component of the normal. |
System.Single | d | The distance of the plane along its normal from the origin. |
Plane(Single[])
Initializes a new instance of the Plane struct.
public Plane(float[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | values | The values to assign to the A, B, C, and D components of the plane. This must be an array with four elements. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentOutOfRangeException | Thrown when |
Fields
D
The distance of the plane along its normal from the origin.
public float D
Field Value
Type | Description |
---|---|
System.Single |
Normal
The normal vector of the plane.
public Vector3 Normal
Field Value
Type | Description |
---|---|
Vector3 |
Properties
Item[Int32]
Gets or sets the component at the specified index.
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | 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
Type | Description |
---|---|
System.Single | The value of the A, B, C, or D component, depending on the index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Methods
Dot(Plane, Vector4)
Calculates the dot product of the specified vector and plane.
public static float Dot(Plane left, Vector4 right)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector4 | right | The source vector. |
Returns
Type | Description |
---|---|
System.Single | The dot product of the specified plane and vector. |
Dot(ref Plane, ref Vector4, out Single)
Calculates the dot product of the specified vector and plane.
public static void Dot(ref Plane left, ref Vector4 right, out float result)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector4 | right | The source vector. |
System.Single | result | 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
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector3 | right | The source vector. |
Returns
Type | Description |
---|---|
System.Single | The dot product of a specified vector and the normal of the Plane plus the distance value of the plane. |
DotCoordinate(ref Plane, ref Vector3, out Single)
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 Plane left, ref Vector3 right, out float result)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector3 | right | The source vector. |
System.Single | result | 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
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector3 | right | The source vector. |
Returns
Type | Description |
---|---|
System.Single | The dot product of the specified vector and the normal of the plane. |
DotNormal(ref Plane, ref Vector3, out Single)
Calculates the dot product of the specified vector and the normal of the plane.
public static void DotNormal(ref Plane left, ref Vector3 right, out float result)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The source plane. |
Vector3 | right | The source vector. |
System.Single | result | 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
Type | Name | Description |
---|---|---|
Plane | value | The Vector4 to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Intersects(ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public PlaneIntersectionType Intersects(ref BoundingBox box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The box to test. |
Returns
Type | Description |
---|---|
PlaneIntersectionType | Whether the two objects intersected. |
Intersects(ref BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public PlaneIntersectionType Intersects(ref BoundingSphere sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The sphere to test. |
Returns
Type | Description |
---|---|
PlaneIntersectionType | Whether the two objects intersected. |
Intersects(ref Plane)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Plane, out Ray)
Determines if there is an intersection between the current object and a Plane.
public bool Intersects(ref Plane plane, out Ray line)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to test. |
Ray | line | When the method completes, contains the line of intersection as a Ray, or a zero ray if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Ray)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to test. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray, out Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to test. |
Vector3 | point | When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Ray, out Single)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray, out float distance)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to test. |
System.Single | distance | When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two objects intersected. |
Intersects(ref Vector3)
Determines if there is an intersection between the current object and a point.
public PlaneIntersectionType Intersects(ref Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to test. |
Returns
Type | Description |
---|---|
PlaneIntersectionType | Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
public PlaneIntersectionType Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vertex1 | The first vertex of the triangle to test. |
Vector3 | vertex2 | The second vertex of the triagnle to test. |
Vector3 | vertex3 | The third vertex of the triangle to test. |
Returns
Type | Description |
---|---|
PlaneIntersectionType | Whether the two objects intersected. |
Multiply(Plane, Single)
Scales the plane by the given scaling factor.
public static Plane Multiply(Plane value, float scale)
Parameters
Type | Name | Description |
---|---|---|
Plane | value | The plane to scale. |
System.Single | scale | The amount by which to scale the plane. |
Returns
Type | Description |
---|---|
Plane | The scaled plane. |
Multiply(ref Plane, Single, out Plane)
Scales the plane by the given scaling factor.
public static void Multiply(ref Plane value, float scale, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
Plane | value | The plane to scale. |
System.Single | scale | The amount by which to scale the plane. |
Plane | result | 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
Type | Name | Description |
---|---|---|
Plane | plane | The source plane. |
Returns
Type | Description |
---|---|
Plane | The flipped plane. |
Negate(ref Plane, out Plane)
Negates a plane by negating all its coefficients, which result in a plane in opposite direction.
public static void Negate(ref Plane plane, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The source plane. |
Plane | result | 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
Type | Name | Description |
---|---|---|
Plane | plane | The source plane. |
Returns
Type | Description |
---|---|
Plane | The normalized plane. |
Normalize(ref Plane, out Plane)
Changes the coefficients of the normal vector of the plane to make it of unit length.
public static void Normalize(ref Plane plane, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The source plane. |
Plane | result | When the method completes, contains the normalized plane. |
Normalize(Single, Single, Single, Single, out Plane)
Creates a plane of unit length.
public static void Normalize(float normalX, float normalY, float normalZ, float planeD, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
System.Single | normalX | The X component of the normal. |
System.Single | normalY | The Y component of the normal. |
System.Single | normalZ | The Z component of the normal. |
System.Single | planeD | The distance of the plane along its normal from the origin. |
Plane | result | 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
Type | Name | Description |
---|---|---|
Plane | plane | The plane to project the point to. |
Vector3 | point | The point to project. |
Returns
Type | Description |
---|---|
Vector3 | The projected point. |
Project(ref Plane, ref Vector3, out Vector3)
Projects a point onto a plane.
public static void Project(ref Plane plane, ref Vector3 point, out Vector3 result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to project the point to. |
Vector3 | point | The point to project. |
Vector3 | result | The projected point. |
ToArray()
Creates an array containing the elements of the plane.
public float[] ToArray()
Returns
Type | Description |
---|---|
System.Single[] | A four-element array containing the components of the plane. |
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Transform(Plane, Matrix)
Transforms a normalized plane by a matrix.
public static Plane Transform(Plane plane, Matrix transformation)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The normalized source plane. |
Matrix | transformation | The transformation matrix. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Plane | plane | The normalized source plane. |
Quaternion | rotation | The quaternion rotation. |
Returns
Type | Description |
---|---|
Plane | The transformed plane. |
Transform(ref Plane, ref Matrix, out Plane)
Transforms a normalized plane by a matrix.
public static void Transform(ref Plane plane, ref Matrix transformation, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The normalized source plane. |
Matrix | transformation | The transformation matrix. |
Plane | result | When the method completes, contains the transformed plane. |
Transform(ref Plane, ref Quaternion, out Plane)
Transforms a normalized plane by a quaternion rotation.
public static void Transform(ref Plane plane, ref Quaternion rotation, out Plane result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The normalized source plane. |
Quaternion | rotation | The quaternion rotation. |
Plane | result | When the method completes, contains the transformed plane. |
Transform(Plane[], ref Matrix)
Transforms an array of normalized planes by a matrix.
public static void Transform(Plane[] planes, ref Matrix transformation)
Parameters
Type | Name | Description |
---|---|---|
Plane[] | planes | The array of normalized planes to transform. |
Matrix | transformation | The transformation matrix. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
Transform(Plane[], ref Quaternion)
Transforms an array of normalized planes by a quaternion rotation.
public static void Transform(Plane[] planes, ref Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Plane[] | planes | The array of normalized planes to transform. |
Quaternion | rotation | The quaternion rotation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
Operators
Equality(Plane, Plane)
Tests for equality between two objects.
public static bool operator ==(Plane left, Plane right)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The first value to compare. |
Plane | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Inequality(Plane, Plane)
Tests for inequality between two objects.
public static bool operator !=(Plane left, Plane right)
Parameters
Type | Name | Description |
---|---|---|
Plane | left | The first value to compare. |
Plane | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Multiply(Plane, Single)
Scales a plane by the given value.
public static Plane operator *(Plane plane, float scale)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane to scale. |
System.Single | scale | The amount by which to scale the plane. |
Returns
Type | Description |
---|---|
Plane | The scaled plane. |
Multiply(Single, Plane)
Scales a plane by the given value.
public static Plane operator *(float scale, Plane plane)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scale | The amount by which to scale the plane. |
Plane | plane | The plane to scale. |
Returns
Type | Description |
---|---|
Plane | The scaled plane. |
UnaryNegation(Plane)
Negates a plane by negating all its coefficients, which result in a plane in opposite direction.
public static Plane operator -(Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane |
Returns
Type | Description |
---|---|
Plane | The negated plane. |