Frustum

Source: Frustum.ts:42

Frustum object, part of the camera object.


Constructor

new Frustum(options: *): Frustum

Parameters

  • options (*)

Instance Methods

getRightPlane(): NumberArray4

Returns right clipping plane.

Returns

  • NumberArray4 — Right clipping plane coefficients.

getLeftPlane(): NumberArray4

Returns left clipping plane.

Returns

  • NumberArray4 — Left clipping plane coefficients.

getBottomPlane(): NumberArray4

Returns bottom clipping plane.

Returns

  • NumberArray4 — Bottom clipping plane coefficients.

getTopPlane(): NumberArray4

Returns top clipping plane.

Returns

  • NumberArray4 — Top clipping plane coefficients.

getBackwardPlane(): NumberArray4

Returns backward clipping plane.

Returns

  • NumberArray4 — Backward clipping plane coefficients.

getForwardPlane(): NumberArray4

Returns forward clipping plane.

Returns

  • NumberArray4 — Forward clipping plane coefficients.

getProjectionViewMatrix(): NumberArray16

Returns projection-view matrix.

Returns

  • NumberArray16 — Projection-view matrix values.

getProjectionViewRTEMatrix(): NumberArray16

Returns projection-view RTE matrix.

Returns

  • NumberArray16 — Projection-view RTE matrix values.

getProjectionMatrix(): NumberArray16

Returns projection matrix.

Returns

  • NumberArray16 — Projection matrix values.

getInverseProjectionMatrix(): NumberArray16

Returns inverse projection matrix.

Returns

  • NumberArray16 — Inverse projection matrix values.

setProjectionMatrix( viewAngle: number, aspect: number, near: number, far: number, isOrthographic?: boolean, focusDistance?: number, reverseDepth?: boolean, depthZeroToOne?: boolean, )

Sets up camera projection matrix.

Parameters

  • viewAngle (number) — Camera vertical field of view angle in degrees.
  • aspect (number) — Viewport aspect ratio (width / height).
  • near (number) — Near clipping plane distance.
  • far (number) — Far clipping plane distance.
  • isOrthographic (boolean, optional, default: false) — Enables orthographic projection mode.
  • focusDistance (number, optional, default: "this.focusDistance") — Reference distance used to compute orthographic frustum size.
  • reverseDepth (boolean, optional, default: false) — Enables reverse-Z infinite perspective projection.
  • depthZeroToOne (boolean, optional, default: false) — Uses [0, 1] NDC depth range for reverse-Z projection.

setFocusDistance(focusDistance: number)

Sets reference distance used to compute orthographic bounds and rebuilds projection matrices. Keeps current near and far clipping planes unchanged.

Parameters

  • focusDistance (number) — Reference distance.

setOrthoBounds( left: number, right: number, bottom: number, top: number, )

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

Parameters

  • left (number) — Left orthographic bound.
  • right (number) — Right orthographic bound.
  • bottom (number) — Bottom orthographic bound.
  • top (number) — Top orthographic bound.

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

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

Parameters

  • left (number) — Left orthographic bound.
  • right (number) — Right orthographic bound.
  • bottom (number) — Bottom orthographic bound.
  • top (number) — Top orthographic bound.
  • near (number) — Near clipping plane distance.
  • far (number) — Far clipping plane distance.

setNearFar(near: number, far?: number)

Updates near and far clipping planes.

Parameters

  • near (number) — Near clipping plane distance.
  • far (number, optional, default: "this.far") — Far clipping plane distance.

setProjectionViewRTEMatrix(viewRTEMatrix: Mat4)

Updates projection-view RTE matrix.

Parameters

  • viewRTEMatrix (Mat4) — View matrix in RTE coordinates.

setViewMatrix(viewMatrix: Mat4)

Camera's projection matrix values.

Parameters

  • viewMatrix (Mat4) — View matrix.

containsPoint(point: Vec3): boolean

Returns true if the point is inside the frustum.

Parameters

  • point (Vec3) — Cartesian point.

Returns

  • boolean — true when the point is inside.

containsSphereBottomExc(sphere: Sphere): boolean

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

Parameters

  • sphere (Sphere) — Bounding sphere.

Returns

  • boolean — true when the sphere passes all checked planes.

containsSphereButtom(sphere: Sphere): boolean

Checks sphere intersection with the bottom frustum plane only.

Parameters

  • sphere (Sphere) — Bounding sphere.

Returns

  • boolean — true when the sphere is not clipped by the bottom plane.

containsSphere(sphere: Sphere): boolean

Returns true if the sphere is inside the frustum.

Parameters

  • sphere (Sphere) — Bounding sphere.

Returns

  • boolean — true when the sphere is inside.

containsSphere2(center: Vec3, radius: number): boolean

Returns true if the sphere is inside the frustum.

Parameters

  • center (Vec3) — Sphere center.
  • radius (number) — Sphere radius.

Returns

  • boolean — true when the sphere is inside.

containsBox(box: Box): boolean

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

Parameters

  • box (Box) — Bounding box.

Returns

  • boolean — true when the box is not fully outside.