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
Plane(Vector3, Vector3, Vector3)
Initializes a new instance of the Plane struct.
public Plane(Vector3 point1, Vector3 point2, Vector3 point3)
Parameters
point1
Vector3First point of a triangle defining the plane.
point2
Vector3Second point of a triangle defining the plane.
point3
Vector3Third 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
Vector3The normal of the plane.
d
floatThe 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
floatThe 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
floatThe X component of the normal.
b
floatThe Y component of the normal.
c
floatThe Z component of the normal.
d
floatThe 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
isnull
.- 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
Normal
The normal vector of the plane.
public Vector3 Normal
Field Value
Properties
this[int]
Gets or sets the component at the specified index.
public float this[int index] { get; set; }
Parameters
index
intThe 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
Returns
- float
The dot product of the specified plane and vector.
Dot(ref Plane, ref Vector4, out float)
Calculates the dot product of the specified vector and plane.
public static void Dot(ref Plane left, ref Vector4 right, out float result)
Parameters
left
PlaneThe source plane.
right
Vector4The source vector.
result
floatWhen 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
Returns
- float
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 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 Plane left, ref Vector3 right, out float result)
Parameters
left
PlaneThe source plane.
right
Vector3The source vector.
result
floatWhen 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
Returns
- float
The dot product of the specified vector and the normal of the plane.
DotNormal(ref Plane, ref Vector3, out float)
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
left
PlaneThe source plane.
right
Vector3The source vector.
result
floatWhen 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
Returns
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object value)
Parameters
Returns
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 BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public PlaneIntersectionType Intersects(ref BoundingBox box)
Parameters
box
BoundingBoxThe box to test.
Returns
- 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
sphere
BoundingSphereThe sphere to test.
Returns
- 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
plane
PlaneThe plane to test.
Returns
- bool
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
plane
PlaneThe plane to test.
line
RayWhen 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 Ray)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray)
Parameters
ray
RayThe ray to test.
Returns
- bool
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
ray
RayThe ray to test.
point
Vector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(ref Ray, out float)
Determines if there is an intersection between the current object and a Ray.
public bool Intersects(ref Ray ray, out float distance)
Parameters
ray
RayThe ray to test.
distance
floatWhen 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 Vector3)
Determines if there is an intersection between the current object and a point.
public PlaneIntersectionType Intersects(ref Vector3 point)
Parameters
point
Vector3The point to test.
Returns
- 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
vertex1
Vector3The first vertex of the triangle to test.
vertex2
Vector3The second vertex of the triagnle to test.
vertex3
Vector3The 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
Returns
- Plane
The scaled plane.
Multiply(ref Plane, float, out Plane)
Scales the plane by the given scaling factor.
public static void Multiply(ref Plane value, float scale, out Plane result)
Parameters
value
PlaneThe plane to scale.
scale
floatThe amount by which to scale the plane.
result
PlaneWhen 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
PlaneThe source plane.
Returns
- 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
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
PlaneThe source plane.
Returns
- 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
plane
PlaneThe source plane.
result
PlaneWhen 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
floatThe X component of the normal.
normalY
floatThe Y component of the normal.
normalZ
floatThe Z component of the normal.
planeD
floatThe distance of the plane along its normal from the origin.
result
PlaneWhen 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
Returns
- 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
plane
PlaneThe plane to project the point to.
point
Vector3The point to project.
result
Vector3The 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
ToString(IFormatProvider)
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
formatProvider
IFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public string ToString(string format)
Parameters
format
stringThe format.
Returns
ToString(string, IFormatProvider)
Returns a string that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringThe format.
formatProvider
IFormatProviderThe format provider.
Returns
Transform(Plane, Matrix)
Transforms a normalized plane by a matrix.
public static Plane Transform(Plane plane, Matrix transformation)
Parameters
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
PlaneThe normalized source plane.
rotation
QuaternionThe quaternion rotation.
Returns
- 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
plane
PlaneThe normalized source plane.
transformation
MatrixThe transformation matrix.
result
PlaneWhen 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
plane
PlaneThe normalized source plane.
rotation
QuaternionThe quaternion rotation.
result
PlaneWhen 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
planes
Plane[]The array of normalized planes to transform.
transformation
MatrixThe transformation matrix.
Exceptions
- ArgumentNullException
Thrown when
planes
isnull
.
Transform(Plane[], ref Quaternion)
Transforms an array of normalized planes by a quaternion rotation.
public static void Transform(Plane[] planes, ref Quaternion rotation)
Parameters
planes
Plane[]The array of normalized planes to transform.
rotation
QuaternionThe quaternion rotation.
Exceptions
- ArgumentNullException
Thrown when
planes
isnull
.
Operators
operator ==(Plane, Plane)
Tests for equality between two objects.
public static bool operator ==(Plane left, Plane right)
Parameters
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
operator !=(Plane, Plane)
Tests for inequality between two objects.
public static bool operator !=(Plane left, Plane right)
Parameters
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.
operator *(Plane, float)
Scales a plane by the given value.
public static Plane operator *(Plane plane, float scale)
Parameters
Returns
- Plane
The scaled plane.
operator *(float, Plane)
Scales a plane by the given value.
public static Plane operator *(float scale, Plane plane)
Parameters
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.