Plane

Description

struct Tinman.Core.Math.Plane

Represents a plane in 3D space.

Public / Constants

XY


public static readonly attribute XY → (Plane)

The XY-plane, having the positive Z-axis as normal vector.

XZ


public static readonly attribute XZ → (Plane)

The XZ-plane, having the positive Y-axis as normal vector.

YZ


public static readonly attribute YZ → (Plane)

The YZ-plane, having the positive X-axis as normal vector.

Zero


public static readonly attribute Zero → (Plane)

No plane.

Public / Constructors

From​Equation


public static method FromEquation → (4)

in : float64

First plane coefficient.

in : float64

Second plane coefficient.

in : float64

Third plane coefficient.

in : float64

Fourth plane coefficient.

returns → Plane

The plane.

Creates a new instance of Plane.

The plane is computed using the following formula:

a*x + b*y + c*z + d = 0

From​Hessian


public static method FromHessian → (2)

normal in : Vec3D

The plane normal vector (will be normalized if necessary).

distance in : float64

Distance of the plane from the origin.

returns → Plane

The plane.

Creates a new instance of Plane.

The plane is defined by the Hessian Normal Form:

n * X = -p

where n is the unit-length normal vector (see Normal) and p is the distance of the plane from the origin (see Distance).

From​Point


public static method FromPoint → (2)

in : Vec3D

The point in the plane.

in : Vec3D

The plane normal vector.

returns → Plane

The plane.

Creates a new instance of Plane.

The plane will contain the given point.

From​Points


public static method FromPoints → (3)

in : Vec3D

First triangle vertex.

in : Vec3D

Second triangle vertex.

in : Vec3D

Third triangle vertex.

returns → Plane

The plane.

Creates a new instance of Plane.

The plane will contain the given points, having a normal vector that points in the same direction as (b-a) x (c-a).

Public / Methods

Clip​Line​Segment


[Pure]
public method ClipLineSegment → (2)

ref : Vec3D

First point of line segment.

ref : Vec3D

Second point of line segment.

returns → int32

-1 if the line segment lies entirely within the negative half-space of the plane.
0 if the line segment lies entirely within the positive half-space of the plane.
1 if ref has been updated to represent the clipped line segment.
2 if ref has been updated to represent the clipped line segment.

Clips the given line segment with the positive half-space of this plane.

Distance​To​Point

2 overloads


[Pure]
public method DistanceToPoint1 → (1)

point in : Vec3D

The point.

returns → float64

The distance to this plane.

Computes the distance of the given point to the plane.


[Pure]
public method DistanceToPoint2 → (3)

in : float64

X-coordinate of point.

in : float64

Y-coordinate of point.

in : float64

Z-coordinate of point.

returns → float64

The distance to this plane.

Computes the distance of the given point to the plane.

Flip


[Pure]
public method Flip → ()

returns → Plane

The resulting plane.

Flips the normal vector of this plane.

Intersect​Line​Segment


[Pure]
public method IntersectLineSegment → (2)

in : Vec3D

First point of line segment.

in : Vec3D

Second point of line segment.

returns → Vec3D

The intersection point or Vec3D.Undefined if there is no intersection.

Intersects the given line segment with this plane.

Offset


[Pure]
public method Offset → (1)

amount in : float64

The distance offset to apply.

returns → Plane

The resulting plane.

Applies a distance offset to this plane.

The plane offset is defined as follows:

plane.DistanceToPoint(point)
=
plane.Offset(amount).DistanceToPoint(point) + amount

Project


[Pure]
public method Project → (1)

in : Vec3D

The point to project.

returns → Vec3D

The projected point on this plane.

Projects the given point onto this plane.

Transform


[Pure]
public method Transform → (1)

matrix in : Mat4D

The transformation matrix, as would be used for normal vectors.

returns → Plane

The resulting plane.

Transforms this plane.

Planes must be transformed using the inverse transpose of the matrix that is used to transform points, just like normal vectors.

Translate


[Pure]
public method Translate → (1)

offset in : Vec3D

The translation offset.

returns → Plane

The resulting plane.

Translates this plane.

Public / Attributes

Coefficients


public attribute Coefficients → (get)

value : Vec4D

The coefficients vector.

Returns the plane coefficients.

This value refers to the general plane equation:

a*x + b*y + c*z + d = 0

where a, b, c and d are returned as the Vec4D.X, Vec4D.Y, Vec4D.Z and Vec4D.W components.

Distance


public attribute Distance → (get)

value : float64

The distance value.

Distance of the plane to the coordinate origin.

This value refers to the Hessian Normal Form:

n * X = -p

where n is the unit-length normal vector (see Normal) and p is the distance of the plane from the origin.

Normal


public attribute Normal → (get)

value : Vec3D

The unit normal vector.

Unit-length plane normal vector.

This value refers to the Hessian Normal Form:

n * X = -p

where n is the unit-length normal vector and p is the distance of the plane from the origin (see Distance).

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Plane>)

The serialization helper object for values of Plane.