Table of Contents

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

point Vector3

The point.

normal Vector3

The normal.

Returns

Plane

DistanceTo(Plane, ref Vector3)

Calculates the distance from a point to a plane.

public static float DistanceTo(this Plane p, ref Vector3 point)

Parameters

p Plane
point Vector3

The point used to calculate distance

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

plane Plane

The Plane

point Vector3

The point used to calculate distance

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

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 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 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 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 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.

Flip(Plane)

Create a new plane facing the opposite direction

public static Plane Flip(this Plane plane)

Parameters

plane Plane

The Plane

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

plane Plane

The Plane

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

p Plane
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.

Returns

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].

GetPlanOrigin(Plane)

Get the origin of the plane.

public static Vector3 GetPlanOrigin(this Plane plane)

Parameters

plane Plane

Returns

Vector3

GetPlanOrigin(ref Plane)

Get the origin of the plane.

public static Vector3 GetPlanOrigin(ref Plane plane)

Parameters

plane Plane

Returns

Vector3

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

p Plane
box BoundingBox

The 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

p Plane
sphere BoundingSphere

The 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

p Plane
ray Ray

The ray to test.

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

p Plane
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(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

p Plane
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(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

p Plane
plane Plane

The plane to test.

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

p Plane
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(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

p Plane

The p.

point Vector3

The point.

Returns

PlaneIntersectionType

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

p Plane
vertex1 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The 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

p Plane

The p.

box BoundingBox

The box.

Returns

PlaneIntersectionType

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

p Plane

The p.

sphere BoundingSphere

The sphere.

Returns

PlaneIntersectionType

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

p Plane

The p.

ray Ray

The ray.

Returns

bool

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

p Plane

The p.

ray Ray

The ray.

point Vector3

The point.

Returns

bool

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

p Plane

The p.

ray Ray

The ray.

distance float

The distance.

Returns

bool

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

p Plane

The p.

plane Plane

The plane.

Returns

bool

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

p Plane

The p.

plane Plane

The plane.

line Ray

The line.

Returns

bool

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

p Plane
point Vector3

The point to test.

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

p Plane

The p.

vertex1 Vector3

The vertex1.

vertex2 Vector3

The vertex2.

vertex3 Vector3

The vertex3.

Returns

PlaneIntersectionType

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

p Plane
p0 Vector3
p1 Vector3
intersection Vector3

Returns

bool

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

p Plane
p0 Vector3
p1 Vector3
intersection Vector3

Returns

bool

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 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 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.

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

plane Plane

Returns

Plane

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

p Plane
point Vector3

The point used to calculate projection

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

plane Plane

The Plane

point Vector3

The point used to calculate projection

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

p Plane

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

p Plane
result Matrix3x3

When the method completes, contains the reflection Matrix3x3.

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

p Plane

The p.

result Matrix4x4

The result.

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

p Plane

Returns

Matrix3x3

The reflection Matrix3x3.

Set(ref Plane, int, float)

public static void Set(ref Plane p, int index, float value)

Parameters

p Plane
index int
value float

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

p Plane
light Vector4

The 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

p Plane
light Vector4

The 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.

result Matrix4x4

When 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

light Vector4

The 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.

plane Plane

The 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

light Vector4

The 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.

plane Plane

The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.

result Matrix3x3

When 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

p Plane

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

plane Plane

The normalized source plane.

transformation Matrix4x4

The transformation matrix.

result Plane

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

plane Plane

The normalized source plane.

rotation Quaternion

The quaternion rotation.

result Plane

When 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

planes Plane[]

The array of normalized planes to transform.

transformation Matrix4x4

The transformation matrix.

Exceptions

ArgumentNullException

Thrown when planes is null.

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 Quaternion

The quaternion rotation.

Exceptions

ArgumentNullException

Thrown when planes is null.