NASA World Wind

gov.nasa.worldwind.geom
Class Frustum

java.lang.Object
  extended by gov.nasa.worldwind.geom.Frustum

public class Frustum
extends java.lang.Object

Instances of Frustum are immutable.


Constructor Summary
Frustum()
          Create a default frustum with six Planes.
Frustum(Plane left, Plane right, Plane bottom, Plane top, Plane near, Plane far)
          Create a frustum from six Planes, which define its boundaries.
 
Method Summary
 boolean contains(Vec4 point)
           
 boolean equals(java.lang.Object obj)
           
static Frustum fromPerspective(Angle horizontalFieldOfView, int viewportWidth, int viewportHeight, double near, double far)
          Creates a Frustum from a horizontal field-of-view, viewport aspect ratio and distance to near and far depth clipping planes.
static Frustum fromPerspective(double width, double height, double near, double far)
          Creates a Frustum from three sets of parallel clipping planes (a parallel projectionMatrix).
static Frustum fromProjectionMatrix(Matrix projectionMatrix)
           
 Plane[] getAllPlanes()
           
 Plane getBottom()
           
 Plane getFar()
           
 Plane getLeft()
           
 Plane getNear()
           
 Plane getRight()
           
 Plane getTop()
           
 int hashCode()
           
 boolean intersects(Extent extent)
           
 java.lang.String toString()
           
 Frustum transformBy(Matrix matrix)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Frustum

public Frustum()
Create a default frustum with six Planes. This defines a box of dimension (2, 2, 2) centered at the origin.


Frustum

public Frustum(Plane left,
               Plane right,
               Plane bottom,
               Plane top,
               Plane near,
               Plane far)
Create a frustum from six Planes, which define its boundaries. Does not except null arguments.

Parameters:
near - the near plane
far - the far plane
left - the left side of the view frustum
right - the right side of the view frustm
top - the top of the view frustum
bottom - the bottom of the view frustum
Throws:
java.lang.IllegalArgumentException - if any argument is null
Method Detail

contains

public final boolean contains(Vec4 point)
Parameters:
point -
Returns:
Throws:
java.lang.IllegalArgumentException - if point is null

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

fromPerspective

public static Frustum fromPerspective(Angle horizontalFieldOfView,
                                      int viewportWidth,
                                      int viewportHeight,
                                      double near,
                                      double far)
Creates a Frustum from a horizontal field-of-view, viewport aspect ratio and distance to near and far depth clipping planes. The near plane must be closer than the far plane, and both planes must be a positive distance away.

Parameters:
horizontalFieldOfView - horizontal field-of-view angle in the range (0, 180)
viewportWidth - the width of the viewport in screen pixels
viewportHeight - the height of the viewport in screen pixels
near - distance to the near depth clipping plane
far - distance to far depth clipping plane
Throws:
java.lang.IllegalArgumentException - if fov is not in the range (0, 180), if either near or far are negative, or near is greater than or equal to far

fromPerspective

public static Frustum fromPerspective(double width,
                                      double height,
                                      double near,
                                      double far)
Creates a Frustum from three sets of parallel clipping planes (a parallel projectionMatrix). In this case, the near and far depth clipping planes may be a negative distance away.

Parameters:
near - distance to the near depth clipping plane
far - distance to far depth clipping plane
width - horizontal dimension of the near clipping plane
height - vertical dimension of the near clipping plane
Throws:
java.lang.IllegalArgumentException - if the difference of any plane set (lright - left, top - bottom, far - near) is less than or equal to zero.

fromProjectionMatrix

public static Frustum fromProjectionMatrix(Matrix projectionMatrix)

getAllPlanes

public Plane[] getAllPlanes()

getBottom

public final Plane getBottom()

getFar

public final Plane getFar()

getLeft

public final Plane getLeft()

getNear

public final Plane getNear()

getRight

public final Plane getRight()

getTop

public final Plane getTop()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

intersects

public final boolean intersects(Extent extent)
Parameters:
extent -
Returns:
Throws:
java.lang.IllegalArgumentException - if extent is null

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

transformBy

public Frustum transformBy(Matrix matrix)
Parameters:
matrix -
Returns:
Throws:
java.lang.IllegalArgumentException - if matrix is null

NASA World Wind