NodeWorld

Plane

La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.

csharp
public struct Plane : IFormattable

Namespace NodeWorld.Flux.

A plane: the points p with Dot(normal, p) + distance == 0.

Constructors

Plane

csharp
public Plane(Vector3 inNormal, Vector3 inPoint)

The plane through inPoint, facing inNormal (normalized).

csharp
public Plane(Vector3 inNormal, float d)

The plane facing inNormal (normalized) at distance d: Dot(normal, p) + d == 0.

csharp
public Plane(Vector3 a, Vector3 b, Vector3 c)

The plane through the points a, b and c; its normal is Cross(b - a, c - a), normalized.

Properties

normal

csharp
public Vector3 normal { get; set; }

The normal of the plane, of length 1.

distance

csharp
public float distance { get; set; }

The distance term: Dot(normal, p) + distance == 0 for the points p of the plane.

flipped

csharp
public Plane flipped { get; }

The same plane facing the other way.

Methods

Flip

csharp
public void Flip()

Turns the plane to face the other way.

SetNormalAndPosition

csharp
public void SetNormalAndPosition(Vector3 inNormal, Vector3 inPoint)

Makes it the plane through inPoint, facing inNormal (normalized).

GetDistanceToPoint

csharp
public float GetDistanceToPoint(Vector3 point)

Signed distance from the plane to point: positive on the side the normal faces.

GetSide

csharp
public bool GetSide(Vector3 point)

point is on the side the normal faces.

SameSide

csharp
public bool SameSide(Vector3 inPt0, Vector3 inPt1)

The two points are on the same side of the plane.

ClosestPointOnPlane

csharp
public Vector3 ClosestPointOnPlane(Vector3 point)

The point of the plane nearest to point.

Raycast

csharp
public bool Raycast(Ray ray, out float enter)

The ray meets the plane ahead of its origin: true, with enter the distance along the ray. A ray parallel to the plane gives false.

Translate

csharp
public void Translate(Vector3 translation)

Moves the plane by translation.

csharp
public static Plane Translate(Plane plane, Vector3 translation)

A copy of plane moved by translation.

ToString

csharp
public override string ToString()

"(normal:(x, y, z), distance:d)", with 2 decimals.

csharp
public string ToString(string format)

The same text with the numbers in format.

csharp
public string ToString(string format, IFormatProvider formatProvider)

The same text with the numbers in format (F2 when empty) and formatProvider (the invariant culture when null).