APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.math

public Class Frustum

extends Object
Class Inheritance
Imports
com.badlogic.gdx.graphics.Camera, .OrthographicCamera, .PerspectiveCamera, com.badlogic.gdx.math.Plane.PlaneSide, com.badlogic.gdx.math.collision.BoundingBox, .OrientedBoundingBox

A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
See Also
Camera#frustum

Field Summary

Modifier and TypeField and Description
protected static final Vector3[]
protected static final float[]
public final Vector3[]
planePoints

eight points making up the near and far clipping "rectangles".

protected final float[]
public final Plane[]
planes

the six clipping planes, near, far, left, right, top, bottom

private static final Vector3

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

Whether the bounding box is in the frustum
boundsInFrustum
(BoundingBox
The bounding box
bounds
)

Returns whether the given BoundingBox is in the frustum.

public boolean

Returns:

Whether the bounding box is in the frustum
boundsInFrustum
(Vector3 center, Vector3 dimensions)

Returns whether the given bounding box is in the frustum.

public boolean

Returns:

Whether the bounding box is in the frustum
boundsInFrustum
(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth)

Returns whether the given bounding box is in the frustum.

public boolean

Returns:

Whether the oriented bounding box is in the frustum
boundsInFrustum
(OrientedBoundingBox
The oriented bounding box
obb
)

Returns whether the given OrientedBoundingBox is in the frustum.

public boolean

Returns:

Whether the point is in the frustum.
pointInFrustum
(Vector3
The point
point
)

Returns whether the point is in the frustum.

public boolean

Returns:

Whether the point is in the frustum.
pointInFrustum
(float
The X coordinate of the point
x
,
float
The Y coordinate of the point
y
,
float
The Z coordinate of the point
z
)

Returns whether the point is in the frustum.

public boolean

Returns:

Whether the sphere is in the frustum
sphereInFrustum
(Vector3
The center of the sphere
center
,
float
The radius of the sphere
radius
)

Returns whether the given sphere is in the frustum.

public boolean

Returns:

Whether the sphere is in the frustum
sphereInFrustum
(float
The X coordinate of the center of the sphere
x
,
float
The Y coordinate of the center of the sphere
y
,
float
The Z coordinate of the center of the sphere
z
,
float
The radius of the sphere
radius
)

Returns whether the given sphere is in the frustum.

public boolean

Returns:

Whether the sphere is in the frustum
sphereInFrustumWithoutNearFar
(Vector3
The center of the sphere
center
,
float
The radius of the sphere
radius
)

Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.

public boolean

Returns:

Whether the sphere is in the frustum
sphereInFrustumWithoutNearFar
(float
The X coordinate of the center of the sphere
x
,
float
The Y coordinate of the center of the sphere
y
,
float
The Z coordinate of the center of the sphere
z
,
float
The radius of the sphere
radius
)

Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.

public void
update(Matrix4
the combined projection and view matrices.
inverseProjectionView
)

Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an OrthographicCamera or PerspectiveCamera.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clipSpacePlanePointsback to summary
protected static final Vector3[] clipSpacePlanePoints
clipSpacePlanePointsArrayback to summary
protected static final float[] clipSpacePlanePointsArray
planePointsback to summary
public final Vector3[] planePoints

eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left

planePointsArrayback to summary
protected final float[] planePointsArray
planesback to summary
public final Plane[] planes

the six clipping planes, near, far, left, right, top, bottom

tmpVback to summary
private static final Vector3 tmpV

Constructor Detail

Frustumback to summary
public Frustum()

Method Detail

boundsInFrustumback to summary
public boolean boundsInFrustum(BoundingBox bounds)

Returns whether the given BoundingBox is in the frustum.

Parameters
bounds:BoundingBox

The bounding box

Returns:boolean

Whether the bounding box is in the frustum

boundsInFrustumback to summary
public boolean boundsInFrustum(Vector3 center, Vector3 dimensions)

Returns whether the given bounding box is in the frustum.

Returns:boolean

Whether the bounding box is in the frustum

boundsInFrustumback to summary
public boolean boundsInFrustum(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth)

Returns whether the given bounding box is in the frustum.

Returns:boolean

Whether the bounding box is in the frustum

boundsInFrustumback to summary
public boolean boundsInFrustum(OrientedBoundingBox obb)

Returns whether the given OrientedBoundingBox is in the frustum.

Parameters
obb:OrientedBoundingBox

The oriented bounding box

Returns:boolean

Whether the oriented bounding box is in the frustum

pointInFrustumback to summary
public boolean pointInFrustum(Vector3 point)

Returns whether the point is in the frustum.

Parameters
point:Vector3

The point

Returns:boolean

Whether the point is in the frustum.

pointInFrustumback to summary
public boolean pointInFrustum(float x, float y, float z)

Returns whether the point is in the frustum.

Parameters
x:float

The X coordinate of the point

y:float

The Y coordinate of the point

z:float

The Z coordinate of the point

Returns:boolean

Whether the point is in the frustum.

sphereInFrustumback to summary
public boolean sphereInFrustum(Vector3 center, float radius)

Returns whether the given sphere is in the frustum.

Parameters
center:Vector3

The center of the sphere

radius:float

The radius of the sphere

Returns:boolean

Whether the sphere is in the frustum

sphereInFrustumback to summary
public boolean sphereInFrustum(float x, float y, float z, float radius)

Returns whether the given sphere is in the frustum.

Parameters
x:float

The X coordinate of the center of the sphere

y:float

The Y coordinate of the center of the sphere

z:float

The Z coordinate of the center of the sphere

radius:float

The radius of the sphere

Returns:boolean

Whether the sphere is in the frustum

sphereInFrustumWithoutNearFarback to summary
public boolean sphereInFrustumWithoutNearFar(Vector3 center, float radius)

Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.

Parameters
center:Vector3

The center of the sphere

radius:float

The radius of the sphere

Returns:boolean

Whether the sphere is in the frustum

sphereInFrustumWithoutNearFarback to summary
public boolean sphereInFrustumWithoutNearFar(float x, float y, float z, float radius)

Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.

Parameters
x:float

The X coordinate of the center of the sphere

y:float

The Y coordinate of the center of the sphere

z:float

The Z coordinate of the center of the sphere

radius:float

The radius of the sphere

Returns:boolean

Whether the sphere is in the frustum

updateback to summary
public void update(Matrix4 inverseProjectionView)

Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an OrthographicCamera or PerspectiveCamera.

Parameters
inverseProjectionView:Matrix4

the combined projection and view matrices.