Class PlaneHelper
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
Represents a plane in three dimensional space.
public static class PlaneHelper
- Inheritance
-
PlaneHelper
- Inherited Members
Methods
Create(Vector3, Vector3)
Create a plane from a specific origin and normal.
public static Plane Create(Vector3 point, Vector3 normal)
Parameters
Returns
DistanceTo(Plane, ref Vector3)
Calculates the distance from a point to a plane.
public static float DistanceTo(this Plane p, ref Vector3 point)
Parameters
Returns
- float
The distance from given point to the given plane
Equal zero: Point on the plane
Greater than zero: The point is on the same side of the plane's normal vector
Less than zero: The point is on the opposite side of the plane's normal vector
DistanceTo(ref Plane, ref Vector3)
Calculates the distance from a point to a plane.
public static float DistanceTo(ref Plane plane, ref Vector3 point)
Parameters
Returns
- float
The distance from given point to the given plane
Equal zero: Point on the plane
Greater than zero: The point is on the same side of the plane's normal vector
Less than zero: The point is on the opposite side of the plane's normal 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
leftPlaneThe source plane.
rightVector3The source vector.
resultfloatWhen 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
leftPlaneThe source plane.
rightVector3The source vector.
resultfloatWhen the method completes, contains the dot product of the specified vector and the normal of the plane.
Flip(Plane)
Create a new plane facing the opposite direction
public static Plane Flip(this Plane plane)
Parameters
Returns
- Plane
A new plane facing the opposite direction
Flip(ref Plane)
Create a new plane facing the opposite direction
public static Plane Flip(ref Plane plane)
Parameters
Returns
- Plane
A new plane facing the opposite direction
Get(Plane, int)
Gets or sets the component at the specified index.
public static float Get(this Plane p, int index)
Parameters
pPlaneindexintThe 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.
Returns
- float
The value of the A, B, C, or D component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
indexis out of the range [0, 3].
GetPlanOrigin(Plane)
Get the origin of the plane.
public static Vector3 GetPlanOrigin(this Plane plane)
Parameters
planePlane
Returns
GetPlanOrigin(ref Plane)
Get the origin of the plane.
public static Vector3 GetPlanOrigin(ref Plane plane)
Parameters
planePlane
Returns
Intersects(Plane, ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public static PlaneIntersectionType Intersects(this Plane p, ref BoundingBox box)
Parameters
pPlaneboxBoundingBoxThe box to test.
Returns
- PlaneIntersectionType
Whether the two objects intersected.
Intersects(Plane, ref BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public static PlaneIntersectionType Intersects(this Plane p, ref BoundingSphere sphere)
Parameters
pPlanesphereBoundingSphereThe sphere to test.
Returns
- PlaneIntersectionType
Whether the two objects intersected.
Intersects(Plane, ref Ray)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(this Plane p, ref Ray ray)
Parameters
Returns
- bool
Whether the two objects intersected.
Intersects(Plane, ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(this Plane p, ref Ray ray, out Vector3 point)
Parameters
pPlanerayRayThe ray to test.
pointVector3When the method completes, contains the point of intersection, or Zero if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(Plane, ref Ray, out float)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(this Plane p, ref Ray ray, out float distance)
Parameters
pPlanerayRayThe ray to test.
distancefloatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
Returns
- bool
Whether the two objects intersected.
Intersects(Plane, ref Plane)
Determines if there is an intersection between the current object and a Plane.
public static bool Intersects(this Plane p, ref Plane plane)
Parameters
Returns
- bool
Whether the two objects intersected.
Intersects(Plane, ref Plane, out Ray)
Determines if there is an intersection between the current object and a Plane.
public static bool Intersects(this Plane p, ref Plane plane, out Ray line)
Parameters
pPlaneplanePlaneThe plane to test.
lineRayWhen 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(Plane, ref Vector3)
Determines if there is an intersection between the current object and a point.
public static PlaneIntersectionType Intersects(this Plane p, ref Vector3 point)
Parameters
Returns
Intersects(Plane, ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
public static PlaneIntersectionType Intersects(this Plane p, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
pPlanevertex1Vector3The first vertex of the triangle to test.
vertex2Vector3The second vertex of the triangle to test.
vertex3Vector3The third vertex of the triangle to test.
Returns
- PlaneIntersectionType
Whether the two objects intersected.
Intersects(ref Plane, ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public static PlaneIntersectionType Intersects(ref Plane p, ref BoundingBox box)
Parameters
pPlaneThe p.
boxBoundingBoxThe box.
Returns
Intersects(ref Plane, ref BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public static PlaneIntersectionType Intersects(ref Plane p, ref BoundingSphere sphere)
Parameters
pPlaneThe p.
sphereBoundingSphereThe sphere.
Returns
Intersects(ref Plane, ref Ray)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(ref Plane p, ref Ray ray)
Parameters
Returns
Intersects(ref Plane, ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(ref Plane p, ref Ray ray, out Vector3 point)
Parameters
Returns
Intersects(ref Plane, ref Ray, out float)
Determines if there is an intersection between the current object and a Ray.
public static bool Intersects(ref Plane p, ref Ray ray, out float distance)
Parameters
Returns
Intersects(ref Plane, ref Plane)
Determines if there is an intersection between the current object and a Plane.
public static bool Intersects(ref Plane p, ref Plane plane)
Parameters
Returns
Intersects(ref Plane, ref Plane, out Ray)
Determines if there is an intersection between the current object and a Plane.
public static bool Intersects(ref Plane p, ref Plane plane, out Ray line)
Parameters
Returns
Intersects(ref Plane, ref Vector3)
Determines if there is an intersection between the current object and a point.
public static PlaneIntersectionType Intersects(ref Plane p, ref Vector3 point)
Parameters
Returns
- PlaneIntersectionType
Whether the two objects intersected.
Intersects(ref Plane, ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
public static PlaneIntersectionType Intersects(ref Plane p, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
pPlaneThe p.
vertex1Vector3The vertex1.
vertex2Vector3The vertex2.
vertex3Vector3The vertex3.
Returns
IntersectsLine(Plane, ref Vector3, ref Vector3, out Vector3)
Check if a line intersects with plane
public static bool IntersectsLine(this Plane p, ref Vector3 p0, ref Vector3 p1, out Vector3 intersection)
Parameters
Returns
IntersectsLine(ref Plane, ref Vector3, ref Vector3, out Vector3)
Check if a line intersects with plane
public static bool IntersectsLine(ref Plane p, ref Vector3 p0, ref Vector3 p1, out Vector3 intersection)
Parameters
Returns
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
valuePlaneThe plane to scale.
scalefloatThe amount by which to scale the plane.
resultPlaneWhen the method completes, contains the scaled plane.
Normalize(Plane)
Changes the coefficients of the normal vector of the plane to make it of unit length.
public static Plane Normalize(this Plane plane)
Parameters
planePlane
Returns
Project(Plane, ref Vector3)
Calculates the projection of a point onto a plane (nearest point).
public static Vector3 Project(this Plane p, ref Vector3 point)
Parameters
Returns
- Vector3
The projection of a given point on a given plane.
Project(ref Plane, ref Vector3)
Calculates the projection of a point onto a plane (nearest point).
public static Vector3 Project(ref Plane plane, ref Vector3 point)
Parameters
Returns
- Vector3
The projection of a given point on a given plane.
Reflection(Plane)
Builds a matrix that can be used to reflect vectors about a plane.
public static Matrix4x4 Reflection(this Plane p)
Parameters
pPlane
Returns
- Matrix4x4
The reflection matrix.
Reflection(ref Plane, out Matrix3x3)
Builds a Matrix3x3 that can be used to reflect vectors about a plane for which the reflection occurs. This plane is assumed to be normalized
public static void Reflection(ref Plane p, out Matrix3x3 result)
Parameters
Reflection(ref Plane, out Matrix4x4)
Builds a matrix that can be used to reflect vectors about a plane.
public static void Reflection(ref Plane p, out Matrix4x4 result)
Parameters
Reflection3x3(Plane)
Builds a Matrix3x3 that can be used to reflect vectors about a plane for which the reflection occurs. This plane is assumed to be normalized
public static Matrix3x3 Reflection3x3(this Plane p)
Parameters
pPlane
Returns
- Matrix3x3
The reflection Matrix3x3.
Set(ref Plane, int, float)
public static void Set(ref Plane p, int index, float value)
Parameters
Shadow(Plane, Vector4)
Creates a matrix that flattens geometry into a shadow from this the plane onto which to project the geometry as a shadow. This plane is assumed to be normalized
public static Matrix4x4 Shadow(this Plane p, Vector4 light)
Parameters
pPlanelightVector4The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.
Returns
- Matrix4x4
The shadow matrix.
Shadow(ref Plane, ref Vector4, out Matrix4x4)
Creates a matrix that flattens geometry into a shadow from the plane onto which to project the geometry as a shadow. This plane is assumed to be normalized
public static void Shadow(ref Plane p, ref Vector4 light, out Matrix4x4 result)
Parameters
pPlanelightVector4The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.
resultMatrix4x4When the method completes, contains the shadow matrix.
Shadow(Vector4, Plane)
Creates a Matrix3x3 that flattens geometry into a shadow.
public static Matrix3x3 Shadow(Vector4 light, Plane plane)
Parameters
lightVector4The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.
planePlaneThe plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.
Returns
- Matrix3x3
The shadow Matrix3x3.
Shadow(ref Vector4, ref Plane, out Matrix3x3)
Creates a Matrix3x3 that flattens geometry into a shadow.
public static void Shadow(ref Vector4 light, ref Plane plane, out Matrix3x3 result)
Parameters
lightVector4The light direction. If the W component is 0, the light is directional light; if the W component is 1, the light is a point light.
planePlaneThe plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.
resultMatrix3x3When the method completes, contains the shadow Matrix3x3.
ToArray(Plane)
Creates an array containing the elements of the plane.
public static float[] ToArray(this Plane p)
Parameters
pPlane
Returns
- float[]
A four-element array containing the components of the plane.
Transform(ref Plane, ref Matrix4x4, out Plane)
Transforms a normalized plane by a matrix.
public static void Transform(ref Plane plane, ref Matrix4x4 transformation, out Plane result)
Parameters
planePlaneThe normalized source plane.
transformationMatrix4x4The transformation matrix.
resultPlaneWhen 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
planePlaneThe normalized source plane.
rotationQuaternionThe quaternion rotation.
resultPlaneWhen the method completes, contains the transformed plane.
Transform(Plane[], ref Matrix4x4)
Transforms an array of normalized planes by a matrix.
public static void Transform(Plane[] planes, ref Matrix4x4 transformation)
Parameters
planesPlane[]The array of normalized planes to transform.
transformationMatrix4x4The transformation matrix.
Exceptions
- ArgumentNullException
Thrown when
planesisnull.
Transform(Plane[], ref Quaternion)
Transforms an array of normalized planes by a quaternion rotation.
public static void Transform(Plane[] planes, ref Quaternion rotation)
Parameters
planesPlane[]The array of normalized planes to transform.
rotationQuaternionThe quaternion rotation.
Exceptions
- ArgumentNullException
Thrown when
planesisnull.