TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct Plane in Tinman.Core.Math

Represents a plane in 3D space.

struct Plane  

Public / Attributes

Coefficients

Returns the plane coefficients.

public property Coefficients { get }
type Vec4D
value The coefficients vector.

Remarks:

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 X, Y, Z and W components.

Distance

Distance of the plane to the coordinate origin.

public property Distance { get }
type float64
value The distance value.

Remarks:

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

Unit-length plane normal vector.

public property Normal { get }
type Vec3D
value The unit normal vector.

Remarks:

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

Public / Constants

XY

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

public static readonly field XY
type Plane

XZ

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

public static readonly field XZ
type Plane

YZ

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

public static readonly field YZ
type Plane

Zero

No plane.

public static readonly field Zero
type Plane

Public / Constructors

FromEquation

Creates a new instance of Plane.

public static method FromEquation (float64 a, float64 b, float64 c, float64 d)
type Plane
params a First plane coefficient.
  b Second plane coefficient.
  c Third plane coefficient.
  d Fourth plane coefficient.
returns The plane.

Remarks:

The plane is computed using the following formula:

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

FromHessian

Creates a new instance of Plane.

public static method FromHessian (Vec3D normal, float64 distance)
type Plane
params normal The plane normal vector (will be normalized if necessary).
  distance Distance of the plane from the origin.
returns The plane.

Remarks:

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

FromPoint

Creates a new instance of Plane.

public static method FromPoint (Vec3D p, Vec3D n)
type Plane
params p The point in the plane.
  n The plane normal vector.
returns The plane.

Remarks:

The plane will contain the given point.

FromPoints

Creates a new instance of Plane.

public static method FromPoints (Vec3D a, Vec3D b, Vec3D c)
type Plane
params a First triangle vertex.
  b Second triangle vertex.
  c Third triangle vertex.
returns The plane.

Remarks:

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

ClipLineSegment

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

[Pure]
public method ClipLineSegment (ref Vec3D a, ref Vec3D b)
type int32
params a First point of line segment.
  b Second point of line segment.
returns -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 a has been updated to represent the clipped line segment.
2 if b has been updated to represent the clipped line segment.

DistanceToPoint

Computes the distance of the given point to the plane.

[Pure]
public method DistanceToPoint (Vec3D point)
type float64
params point The point.
returns The distance to this plane.

Computes the distance of the given point to the plane.

[Pure]
public method DistanceToPoint (float64 x, float64 y, float64 z)
type float64
params x X-coordinate of point.
  y Y-coordinate of point.
  z Z-coordinate of point.
returns The distance to this plane.

Flip

Flips the normal vector of this plane.

[Pure]
public method Flip ()
type Plane
returns The resulting plane.

IntersectLineSegment

Intersects the given line segment with this plane.

[Pure]
public method IntersectLineSegment (Vec3D a, Vec3D b)
type Vec3D
params a First point of line segment.
  b Second point of line segment.
returns The intersection point or Undefined if there is no intersection.

Offset

Applies a distance offset to this plane.

[Pure]
public method Offset (float64 amount)
type Plane
params amount The distance offset to apply.
returns The resulting plane.

Remarks:

The plane offset is defined as follows:

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

Project

Projects the given point onto this plane.

[Pure]
public method Project (Vec3D p)
type Vec3D
params p The point to project.
returns The projected point on this plane.

Transform

Transforms this plane.

[Pure]
public method Transform (Mat4D matrix)
type Plane
params matrix The transformation matrix, as would be used for normal vectors.
returns The resulting plane.

Remarks:

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

Translate

Translates this plane.

[Pure]
public method Translate (Vec3D offset)
type Plane
params offset The translation offset.
returns The resulting plane.

Serialization

Serializer

The serialization helper object for values of Plane.

public static readonly field Serializer
type ITypeSerializer<Plane>