Frustum

open class Frustum

Represents a six-sided view frustum in Cartesian coordinates with a corresponding viewport in screen coordinates.

Constructors

Link copied to clipboard
constructor()

Constructs a new unit frustum with each of its planes 1 meter from the center and a viewport with width and height both 1.

constructor(left: Plane, right: Plane, bottom: Plane, top: Plane, near: Plane, far: Plane, viewport: Viewport)

Constructs a frustum from planes.

Functions

Link copied to clipboard

See if the point is entirely within the frustum. The dot product of the point with each plane's vector provides a distance to each plane. If this distance is less than 0, the point is clipped by that plane and neither intersects nor is contained by the space enclosed by this Frustum.

Link copied to clipboard
fun intersectsSegment(pointA: Vec3, pointB: Vec3): Boolean

Determines whether a line segment intersects this frustum.

Link copied to clipboard

Determines whether a screen coordinate viewport intersects this frustum.

Link copied to clipboard
fun setToModelviewProjection(projection: Matrix4, modelview: Matrix4, viewport: Viewport): Frustum

Sets this frustum to one appropriate for a modelview-projection matrix. A modelview-projection matrix's view frustum is a Cartesian volume that contains everything visible in a scene displayed using that modelview-projection matrix.
This method assumes that the specified matrices represents a projection matrix and a modelview matrix respectively. If this is not the case the results are undefined.

fun setToModelviewProjection(projection: Matrix4, modelview: Matrix4, viewport: Viewport, subViewport: Viewport): Frustum

Sets this frustum to one appropriate for a subset of a modelview-projection matrix. A modelview-projection matrix's view frustum is a Cartesian volume that contains everything visible in a scene displayed using that modelview-projection matrix. The subset is defined by the region within the original viewport that the frustum contains.
This method assumes that the specified matrices represents a projection matrix and a modelview matrix respectively. If this is not the case the results are undefined.

Link copied to clipboard

Sets this frustum to a unit frustum with each of its planes 1 meter from the center a viewport with width and height both 1.