Home Reference Source
import {Plane} from 'math-ds'
public class | source

Plane

A plane.

Constructor Summary

Public Constructor
public

constructor(normal: Vector3, constant: Number)

Constructs a new plane.

Member Summary

Public Members
public

The constant.

public

The normal.

Method Summary

Public Methods
public

Clones this plane.

public

Calculates a coplanar point and returns it.

public

Copies the given plane.

public

Calculates the distance from this plane to the given point.

public

Calculates the distance from this plane to the given sphere.

public

Checks if this plane equals the given one.

public

Finds the point of intersection between this plane and a given line.

public

Checks if this plane intersects with the given box.

public

Checks if this plane intersects with the given line.

public

Checks if this plane intersects with the given sphere.

public

Negates this plane.

public

Normalizes this plane.

public

Projects the given point on this plane.

public

set(normal: Vector3, constant: Number): Plane

Sets the normal and the constant.

public

Sets the components of this plane.

public

Sets this plane from three distinct coplanar points.

public

Sets this plane from a normal and a coplanar point.

public

translate(offset: Vector3): Plane

Translates this plane.

Public Constructors

public constructor(normal: Vector3, constant: Number) source

Constructs a new plane.

Params:

NameTypeAttributeDescription
normal Vector3
  • optional

The normal.

constant Number
  • optional

The constant.

Public Members

public constant: Number source

The constant.

public normal: Vector3 source

The normal.

Public Methods

public clone(): Plane source

Clones this plane.

Return:

Plane

The cloned plane.

public coplanarPoint(target: Vector3): Vector3 source

Calculates a coplanar point and returns it.

Params:

NameTypeAttributeDescription
target Vector3
  • optional

A target vector. If none is provided, a new one will be created.

Return:

Vector3

A coplanar plane.

public copy(p: Plane): Plane source

Copies the given plane.

Params:

NameTypeAttributeDescription
p Plane

A plane.

Return:

Plane

This plane.

public distanceToPoint(p: Vector3): Number source

Calculates the distance from this plane to the given point.

Params:

NameTypeAttributeDescription
p Vector3

A point.

Return:

Number

The length.

public distanceToSphere(s: Sphere): Number source

Calculates the distance from this plane to the given sphere.

Params:

NameTypeAttributeDescription
s Sphere

A sphere.

Return:

Number

The length.

public equals(p: Plane): Boolean source

Checks if this plane equals the given one.

Params:

NameTypeAttributeDescription
p Plane

A plane.

Return:

Boolean

Whether this plane equals the given one.

public intersectLine(l: Line3, target: Vector3): Vector3 source

Finds the point of intersection between this plane and a given line.

Params:

NameTypeAttributeDescription
l Line3

A line.

target Vector3
  • optional

A target vector. If none is provided, a new one will be created.

Return:

Vector3

The intersection point.

public intersectsBox(b: Box3): Boolean source

Checks if this plane intersects with the given box.

Params:

NameTypeAttributeDescription
b Box3

A box.

Return:

Boolean

Whether this plane intersects with the given box.

public intersectsLine(l: Line3): Boolean source

Checks if this plane intersects with the given line.

Params:

NameTypeAttributeDescription
l Line3

A line.

Return:

Boolean

Whether this plane intersects with the given line.

public intersectsSphere(s: Sphere): Boolean source

Checks if this plane intersects with the given sphere.

Params:

NameTypeAttributeDescription
s Sphere

A sphere.

Return:

Boolean

Whether this plane intersects with the given sphere.

public negate(): Plane source

Negates this plane.

Return:

Plane

This plane.

public normalize(): Plane source

Normalizes this plane.

Return:

Plane

This plane.

public projectPoint(p: Vector3, target: Vector3): Vector3 source

Projects the given point on this plane.

Params:

NameTypeAttributeDescription
p Vector3

A point.

target Vector3
  • optional

A target vector. If none is provided, a new one will be created.

Return:

Vector3

The projected point.

public set(normal: Vector3, constant: Number): Plane source

Sets the normal and the constant.

Params:

NameTypeAttributeDescription
normal Vector3

The normal.

constant Number

The constant.

Return:

Plane

This plane.

public setComponents(x: Number, y: Number, z: Number, w: Number): Plane source

Sets the components of this plane.

Params:

NameTypeAttributeDescription
x Number

The X component of the normal.

y Number

The Y component of the normal.

z Number

The Z component of the normal.

w Number

The constant.

Return:

Plane

This plane.

public setFromCoplanarPoints(p0: Vector3, p1: Vector3, p2: Vector3): Plane source

Sets this plane from three distinct coplanar points.

Params:

NameTypeAttributeDescription
p0 Vector3

A coplanar point.

p1 Vector3

A coplanar point.

p2 Vector3

A coplanar point.

Return:

Plane

This plane.

public setFromNormalAndCoplanarPoint(n: Vector3, p: Vector3): Sphere source

Sets this plane from a normal and a coplanar point.

Params:

NameTypeAttributeDescription
n Vector3

The normal.

p Vector3

The coplanar point.

Return:

Sphere

This sphere.

public translate(offset: Vector3): Plane source

Translates this plane.

Params:

NameTypeAttributeDescription
offset Vector3

An offset.

Return:

Plane

This plane.