Skip to content

Documentation / base / Plane

Class: Plane ​

Defined in: libs/base/src/math/plane.ts:7

The plane class

Extends ​

Indexable ​

[index: number]: number

Constructors ​

Constructor ​

new Plane(): Plane

Defined in: libs/base/src/math/plane.ts:23

Construct a plane lying on the XZ axis with upwards normal

Returns ​

Plane

Overrides ​

VectorBase.constructor

Constructor ​

new Plane(a, b, c, d): Plane

Defined in: libs/base/src/math/plane.ts:31

Construct a plane that satisfies the equation Ax+By+Cz+D=0

Parameters ​

a ​

number

The coefficient A of the equation

b ​

number

The coefficient B of the equation

c ​

number

The coefficient C of the equation

d ​

number

The coefficient D of the equation

Returns ​

Plane

Overrides ​

VectorBase.constructor

Constructor ​

new Plane(other): Plane

Defined in: libs/base/src/math/plane.ts:36

Construct a plane by copying another plane

Parameters ​

other ​

Plane

The plane to be copied from.

Returns ​

Plane

Overrides ​

VectorBase.constructor

Constructor ​

new Plane(origin, normal): Plane

Defined in: libs/base/src/math/plane.ts:42

Construct a plane from normal and a point on the plane.

Parameters ​

origin ​

Vector3

The point on the plane.

normal ​

Vector3

Normal of the plane.

Returns ​

Plane

Overrides ​

VectorBase.constructor

Constructor ​

new Plane(p0, p1, p2): Plane

Defined in: libs/base/src/math/plane.ts:49

Construct a plane from three points on the plane.

Parameters ​

p0 ​

Vector3

The first point.

p1 ​

Vector3

The second point.

p2 ​

Vector3

The third point.

Returns ​

Plane

Overrides ​

VectorBase.constructor

Accessors ​

a ​

Get Signature ​

get a(): number

Defined in: libs/base/src/math/plane.ts:83

Get the coefficient A of the plane equation

Returns ​

number

Set Signature ​

set a(val): void

Defined in: libs/base/src/math/plane.ts:86

Parameters ​
val ​

number

Returns ​

void


b ​

Get Signature ​

get b(): number

Defined in: libs/base/src/math/plane.ts:91

Get the coefficient B of the plane equation

Returns ​

number

Set Signature ​

set b(val): void

Defined in: libs/base/src/math/plane.ts:94

Parameters ​
val ​

number

Returns ​

void


c ​

Get Signature ​

get c(): number

Defined in: libs/base/src/math/plane.ts:99

Get the coefficient C of the plane equation

Returns ​

number

Set Signature ​

set c(val): void

Defined in: libs/base/src/math/plane.ts:102

Parameters ​
val ​

number

Returns ​

void


d ​

Get Signature ​

get d(): number

Defined in: libs/base/src/math/plane.ts:107

Get the coefficient D of the plane equation

Returns ​

number

Set Signature ​

set d(val): void

Defined in: libs/base/src/math/plane.ts:110

Parameters ​
val ​

number

Returns ​

void

Methods ​

assign() ​

assign(other): Plane

Defined in: libs/base/src/math/plane.ts:167

Set coefficients of the plane equation.

Parameters ​

other ​

ArrayLike<number>

An array holding the coefficients.

Returns ​

Plane

self


setEquation() ​

setEquation(a, b, c, d): Plane

Defined in: libs/base/src/math/plane.ts:180

Set coefficients of the plane equation.

Parameters ​

a ​

number

The coefficient A of the equation

b ​

number

The coefficient B of the equation

c ​

number

The coefficient C of the equation

d ​

number

The coefficient D of the equation

Returns ​

Plane

self


initWithOriginNormal() ​

initWithOriginNormal(origin, normal): Plane

Defined in: libs/base/src/math/plane.ts:194

Initialize the plane by normal vector and a point on the plane.

Parameters ​

origin ​

Vector3

A point on the plane.

normal ​

Vector3

Normal of the plane.

Returns ​

Plane

self


initWithPoints() ​

initWithPoints(p0, p1, p2): Plane

Defined in: libs/base/src/math/plane.ts:205

Initialize the plane by three points on the plane.

Parameters ​

p0 ​

Vector3

The first point.

p1 ​

Vector3

The second point.

p2 ​

Vector3

The third point.

Returns ​

Plane

self


distanceToPoint() ​

distanceToPoint(p): number

Defined in: libs/base/src/math/plane.ts:214

Calculate the distance from a point to the plane.

Parameters ​

p ​

Vector3

The point

Returns ​

number

The distance value.


nearestPointToPoint() ​

nearestPointToPoint(p, result?): Vector3

Defined in: libs/base/src/math/plane.ts:223

Given a point, calucate the closest point on the plane to that point.

Parameters ​

p ​

Vector3

The given point.

result? ​

Vector3

A point object to which the result will be written, if not specified, a new point object will be returned.

Returns ​

Vector3

The result value.


getNormal() ​

getNormal(result?): Vector3

Defined in: libs/base/src/math/plane.ts:232

Get normal vector of the plane.

Parameters ​

result? ​

Vector3

A vector object to which the result will be written, if not specified, a new vector will be returned.

Returns ​

Vector3

The result vector.


inplaceFlip() ​

inplaceFlip(): Plane

Defined in: libs/base/src/math/plane.ts:236

Inplace flip the normal vector .

Returns ​

Plane


inplaceNormalize() ​

inplaceNormalize(): Plane

Defined in: libs/base/src/math/plane.ts:240

Inplace normalize the plane equation.

Returns ​

Plane


flip() ​

static flip(plane, result?): Plane

Defined in: libs/base/src/math/plane.ts:249

Create a new plane object by flipping another plane's normal.

Parameters ​

plane ​

Plane

The plane to which the normal will be flipped.

result? ​

Plane

A plane object to which the result will be written, if not specified, a new plane object will be returned.

Returns ​

Plane

The result plane.


normalize() ​

static normalize(plane, result?): Plane

Defined in: libs/base/src/math/plane.ts:258

Create a new plane object by normalizing another plane.

Parameters ​

plane ​

Plane

The plane that will be normalized.

result? ​

Plane

A plane object to which the result will be written, if not specified, a new plane object will be returned.

Returns ​

Plane

The result plane.


transform() ​

static transform(plane, matrix, result?): Plane

Defined in: libs/base/src/math/plane.ts:274

Create a new plane object by transforming another plane.

Parameters ​

plane ​

Plane

The plane that will be transformed.

matrix ​

Matrix4x4

The transform matrix.

result? ​

Plane

A plane object to which the result will be written, if not specified, a new plane object will be returned.

Returns ​

Plane

The result plane.


equalsTo() ​

equalsTo(other, epsl?): boolean

Defined in: libs/base/src/math/vector.ts:32

Check if all data is close enough to another

Parameters ​

other ​

Float32Array<ArrayBuffer>

The data to be compared with.

epsl? ​

number

Returns ​

boolean

true if close enough, otherwise false.

Inherited from ​

VectorBase.equalsTo


toString() ​

toString(): string

Defined in: libs/base/src/math/vector.ts:52

Convert this to string object.

Returns ​

string

Inherited from ​

VectorBase.toString


isNaN() ​

isNaN(): boolean

Defined in: libs/base/src/math/vector.ts:61

Check the data for the presence of NaN.

Returns ​

boolean

true if NaN is present, otherwise false.

Inherited from ​

VectorBase.isNaN


setRandom() ​

setRandom(minValue, maxValue): void

Defined in: libs/base/src/math/vector.ts:75

Generate random vector

Parameters ​

minValue ​

number

Minimum value of any component of the vector

maxValue ​

number

Maximum value of any component of the vector

Returns ​

void

Inherited from ​

VectorBase.setRandom

Released under the MIT License.