com.badlogic.gdx.math
Class Frustum

java.lang.Object
  extended by com.badlogic.gdx.math.Frustum

public class Frustum
extends Object

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


Field Summary
 Vector3[] planePoints
          eight points making up the near and far clipping "rectangles".
 Plane[] planes
          the six clipping planes, near, far, left, right, top, bottm
 
Constructor Summary
Frustum()
           
 
Method Summary
 boolean boundsInFrustum(BoundingBox bounds)
          Returns whether the given BoundingBox is in the frustum.
 boolean pointInFrustum(Vector3 point)
          Returns whether the point is in the frustum.
 boolean sphereInFrustum(Vector3 center, float radius)
          Returns whether the given sphere is in the frustum.
 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.
 void update(Matrix4 inverseProjectionView)
          Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

planes

public final Plane[] planes
the six clipping planes, near, far, left, right, top, bottm


planePoints

public final Vector3[] planePoints
eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left

Constructor Detail

Frustum

public Frustum()
Method Detail

update

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 - the combined projection and view matrices.

pointInFrustum

public boolean pointInFrustum(Vector3 point)
Returns whether the point is in the frustum.

Parameters:
point - The point
Returns:
Whether the point is in the frustum.

sphereInFrustum

public boolean sphereInFrustum(Vector3 center,
                               float radius)
Returns whether the given sphere is in the frustum.

Parameters:
center - The center of the sphere
radius - The radius of the sphere
Returns:
Whether the sphere is in the frustum

sphereInFrustumWithoutNearFar

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 - The center of the sphere
radius - The radius of the sphere
Returns:
Whether the sphere is in the frustum

boundsInFrustum

public boolean boundsInFrustum(BoundingBox bounds)
Returns whether the given BoundingBox is in the frustum.

Parameters:
bounds - The bounding box
Returns:
Whether the bounding box is in the frustum


Copyright © 2013. All Rights Reserved.