com.threerings.math
Class Frustum

java.lang.Object
  extended by com.threerings.math.Frustum

public class Frustum
extends Object

A pyramidal frustum.


Nested Class Summary
static class Frustum.IntersectionType
          Intersection types indicating that the frustum does not intersect, intersects, or fully contains, respectively, the parameter.
 
Constructor Summary
Frustum()
          Creates an empty (invalid) frustum.
 
Method Summary
 Box getBounds()
          Returns a reference to the bounds of this frustum.
 float getDistance(Vector3f point)
          Determines the maximum signed distance of the point from the planes of the frustum.
 Frustum.IntersectionType getIntersectionType(Box box)
          Checks whether the frustum intersects the specified box.
 Vector3f[] getVertices()
          Returns a reference to the frustum's array of vertices.
 Frustum setToFrustum(float left, float right, float bottom, float top, float near, float far)
          Sets this frustum to one pointing in the Z- direction with the specified parameters determining its size and shape (see the OpenGL documentation for glFrustum).
 Frustum setToOrtho(float left, float right, float bottom, float top, float near, float far)
          Sets this frustum to an orthographic one pointing in the Z- direction with the specified parameters determining its size (see the OpenGL documentation for glOrtho).
 Frustum setToPerspective(float fovy, float aspect, float znear, float zfar)
          Sets this frustum to one pointing in the Z- direction with the specified parameters determining its size and shape (see the OpenGL documentation for gluPerspective).
 Frustum setToProjection(float left, float right, float bottom, float top, float near, float far, Vector3f nearFarNormal, boolean ortho, boolean mirrored)
          Sets this frustum to a perspective or orthographic projection with the specified parameters determining its size and shape.
 Frustum transform(Transform3D transform)
          Transforms this frustum by the specified transformation.
 Frustum transform(Transform3D transform, Frustum result)
          Transforms this frustum by the specified transformation, placing the result in the object provided.
 Frustum transformLocal(Transform3D transform)
          Transforms this frustum in-place by the specified transformation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Frustum

public Frustum()
Creates an empty (invalid) frustum.

Method Detail

getVertices

public Vector3f[] getVertices()
Returns a reference to the frustum's array of vertices.


getBounds

public Box getBounds()
Returns a reference to the bounds of this frustum.


setToPerspective

public Frustum setToPerspective(float fovy,
                                float aspect,
                                float znear,
                                float zfar)
Sets this frustum to one pointing in the Z- direction with the specified parameters determining its size and shape (see the OpenGL documentation for gluPerspective).

Parameters:
fovy - the vertical field of view, in radians.
aspect - the aspect ratio (width over height).
znear - the distance to the near clip plane.
zfar - the distance to the far clip plane.
Returns:
a reference to this frustum, for chaining.

setToFrustum

public Frustum setToFrustum(float left,
                            float right,
                            float bottom,
                            float top,
                            float near,
                            float far)
Sets this frustum to one pointing in the Z- direction with the specified parameters determining its size and shape (see the OpenGL documentation for glFrustum).

Returns:
a reference to this frustum, for chaining.

setToOrtho

public Frustum setToOrtho(float left,
                          float right,
                          float bottom,
                          float top,
                          float near,
                          float far)
Sets this frustum to an orthographic one pointing in the Z- direction with the specified parameters determining its size (see the OpenGL documentation for glOrtho).

Returns:
a reference to this frustum, for chaining.

setToProjection

public Frustum setToProjection(float left,
                               float right,
                               float bottom,
                               float top,
                               float near,
                               float far,
                               Vector3f nearFarNormal,
                               boolean ortho,
                               boolean mirrored)
Sets this frustum to a perspective or orthographic projection with the specified parameters determining its size and shape.

Returns:
a reference to this frustum, for chaining.

transformLocal

public Frustum transformLocal(Transform3D transform)
Transforms this frustum in-place by the specified transformation.

Returns:
a reference to this frustum, for chaining.

transform

public Frustum transform(Transform3D transform)
Transforms this frustum by the specified transformation.

Returns:
a new frustum containing the result.

transform

public Frustum transform(Transform3D transform,
                         Frustum result)
Transforms this frustum by the specified transformation, placing the result in the object provided.

Returns:
a reference to the result frustum, for chaining.

getDistance

public float getDistance(Vector3f point)
Determines the maximum signed distance of the point from the planes of the frustum. If the distance is less than or equal to zero, the point lies inside the frustum.


getIntersectionType

public Frustum.IntersectionType getIntersectionType(Box box)
Checks whether the frustum intersects the specified box.



Copyright © 2011. All Rights Reserved.