jme.entity.camera
Class Frustum

java.lang.Object
  extended byjme.entity.camera.Frustum

public class Frustum
extends java.lang.Object

Frustum defines the view frustum of the camera. This frustum defines the area that can be seen in the view port. It contains multiple containing methods to allow for testing for whether an object is in the view frustum or not. For reference see

Version:
1
Author:
Mark Powell

Constructor Summary
Frustum()
          Constructor instantiates a new Frustum object.
 
Method Summary
 boolean containsCube(float x, float y, float z, float size)
          containsCube returns a boolean based on if a cube is contained within the frustum or not.
 boolean containsPoint(float x, float y, float z)
          containsPoint returns true if the point supplied is within the boundries of the view frustum.
 boolean containsSphere(float x, float y, float z, float radius)
          containsSphere returns true if any part of a sphere is within the boundries of the view frustum and false otherwise.
 void setBuffer(float value)
          setBuffer sets a buffer for detection if a shape is within the frustum or not.
 void update()
          update refreshes the frustum planes based on any change of the view port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Frustum

public Frustum()
Constructor instantiates a new Frustum object. This sets up the required matrices for the frustum information.

Method Detail

update

public void update()
update refreshes the frustum planes based on any change of the view port.


containsCube

public boolean containsCube(float x,
                            float y,
                            float z,
                            float size)
containsCube returns a boolean based on if a cube is contained within the frustum or not. The cube only need be partly within the frustum for true to be returned. If the cube is entirely outside of the frustum false is returned.

Parameters:
x - the x coordinate of the center of the cube.
y - the y coordinate of the center of the cube.
z - the z coordinate of the center of the cube.
size - the size of a single side of the cube.
Returns:
true if the cube is within the frustum false if it is completely outside of the frustum.

containsPoint

public boolean containsPoint(float x,
                             float y,
                             float z)
containsPoint returns true if the point supplied is within the boundries of the view frustum. If the point is not in the boundries, false is returned.

Parameters:
x - the x coordinate of the point.
y - the y coordinate of the point.
z - the z coordinate of the point.
Returns:
true if the point is in the view frustum, false otherwise.

containsSphere

public boolean containsSphere(float x,
                              float y,
                              float z,
                              float radius)
containsSphere returns true if any part of a sphere is within the boundries of the view frustum and false otherwise.

Parameters:
x - the x coordinate of the center of the sphere.
y - the y coordinate of the center of the sphere.
z - the z coordinate of the center of the sphere.
radius - the radius of the sphere.
Returns:
true if the any part of the sphere is in the view frustum, false otherwise.

setBuffer

public void setBuffer(float value)
setBuffer sets a buffer for detection if a shape is within the frustum or not. This is a scalar, where a higher number allows more checks to pass. The default is 1.0.

Parameters:
value - the new buffer value.