Frustum

Frustum object, part of the camera object.

Constructor

new Frustum(options)

Parameters:
NameTypeDescription
options*

Methods

containsBox(box) → {boolean}

Returns true if the box intersects or is inside the frustum.

Parameters:
NameTypeDescription
boxBox

Bounding box.

Returns:

true when the box is not fully outside.

Type: 
boolean

containsPoint(point) → {boolean}

Returns true if the point is inside the frustum.

Parameters:
NameTypeDescription
pointVec3

Cartesian point.

Returns:

true when the point is inside.

Type: 
boolean

containsSphere(sphere) → {boolean}

Returns true if the sphere is inside the frustum.

Parameters:
NameTypeDescription
sphereSphere

Bounding sphere.

Returns:

true when the sphere is inside.

Type: 
boolean

containsSphere2(center, radius) → {boolean}

Returns true if the sphere is inside the frustum.

Parameters:
NameTypeDescription
centerVec3

Sphere center.

radiusnumber

Sphere radius.

Returns:

true when the sphere is inside.

Type: 
boolean

containsSphereBottomExc(sphere) → {boolean}

Returns true if the sphere is inside the frustum, ignoring the bottom plane.

Parameters:
NameTypeDescription
sphereSphere

Bounding sphere.

Returns:

true when the sphere passes all checked planes.

Type: 
boolean

containsSphereButtom(sphere) → {boolean}

Checks sphere intersection with the bottom frustum plane only.

Parameters:
NameTypeDescription
sphereSphere

Bounding sphere.

Returns:

true when the sphere is not clipped by the bottom plane.

Type: 
boolean

getBackwardPlane() → {NumberArray4}

Returns backward clipping plane.

Returns:

Backward clipping plane coefficients.

Type: 
NumberArray4

getBottomPlane() → {NumberArray4}

Returns bottom clipping plane.

Returns:

Bottom clipping plane coefficients.

Type: 
NumberArray4

getForwardPlane() → {NumberArray4}

Returns forward clipping plane.

Returns:

Forward clipping plane coefficients.

Type: 
NumberArray4

getInverseProjectionMatrix() → {NumberArray16}

Returns inverse projection matrix.

Returns:

Inverse projection matrix values.

Type: 
NumberArray16

getLeftPlane() → {NumberArray4}

Returns left clipping plane.

Returns:

Left clipping plane coefficients.

Type: 
NumberArray4

getProjectionMatrix() → {NumberArray16}

Returns projection matrix.

Returns:

Projection matrix values.

Type: 
NumberArray16

getProjectionViewMatrix() → {NumberArray16}

Returns projection-view matrix.

Returns:

Projection-view matrix values.

Type: 
NumberArray16

getProjectionViewRTEMatrix() → {NumberArray16}

Returns projection-view RTE matrix.

Returns:

Projection-view RTE matrix values.

Type: 
NumberArray16

getRightPlane() → {NumberArray4}

Returns right clipping plane.

Returns:

Right clipping plane coefficients.

Type: 
NumberArray4

getTopPlane() → {NumberArray4}

Returns top clipping plane.

Returns:

Top clipping plane coefficients.

Type: 
NumberArray4

setNearFar(near, faropt)

Updates near and far clipping planes.

Parameters:
NameTypeAttributesDefaultDescription
nearnumber

Near clipping plane distance.

farnumber<optional>
this.far

Far clipping plane distance.

setOrthoBounds(left, right, bottom, top)

Updates orthographic projection bounds and rebuilds projection matrices. Keeps the current near and far clipping planes unchanged.

Parameters:
NameTypeDescription
leftnumber

Left orthographic bound.

rightnumber

Right orthographic bound.

bottomnumber

Bottom orthographic bound.

topnumber

Top orthographic bound.

setOrthoProjection(left, right, bottom, top, near, far)

Updates orthographic projection bounds and clipping planes in one projection rebuild.

Parameters:
NameTypeDescription
leftnumber

Left orthographic bound.

rightnumber

Right orthographic bound.

bottomnumber

Bottom orthographic bound.

topnumber

Top orthographic bound.

nearnumber

Near clipping plane distance.

farnumber

Far clipping plane distance.

setProjectionMatrix(viewAngle, aspect, near, far, isOrthographicopt, focusDistanceopt, reverseDepthopt, depthZeroToOneopt)

Sets up camera projection matrix.

Parameters:
NameTypeAttributesDefaultDescription
viewAnglenumber

Camera vertical field of view angle in degrees.

aspectnumber

Viewport aspect ratio (width / height).

nearnumber

Near clipping plane distance.

farnumber

Far clipping plane distance.

isOrthographicboolean<optional>
false

Enables orthographic projection mode.

focusDistancenumber<optional>
10

Reference distance used to compute orthographic frustum size.

reverseDepthboolean<optional>
false

Enables reverse-Z infinite perspective projection.

depthZeroToOneboolean<optional>
false

Uses [0, 1] NDC depth range for reverse-Z projection.

setProjectionViewRTEMatrix(viewRTEMatrix)

Updates projection-view RTE matrix.

Parameters:
NameTypeDescription
viewRTEMatrixMat4

View matrix in RTE coordinates.

setViewMatrix(viewMatrix)

Camera's projection matrix values.

Parameters:
NameTypeDescription
viewMatrixMat4

View matrix.