JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.math.geom.Frustum Class Reference

Providing frustum planes derived by different inputs (P*MV, ..) used to classify objects. More...

Collaboration diagram for com.jogamp.math.geom.Frustum:

Classes

class  FovDesc
 Frustum description by fovhv and zNear, zFar. More...
 
enum  Location
 
class  Plane
 Plane equation := dot(n, x - p) = 0 -> Ax + By + Cz + d == 0. More...
 

Public Member Functions

 Frustum ()
 Creates an undefined instance w/o calculating the frustum. More...
 
 Frustum (final Frustum o)
 
Frustum set (final Frustum o)
 
final Plane[] getPlanes ()
 Planes are ordered in the returned array as follows: More...
 
Vec4f[] getPlanes (final Vec4f[] out)
 Sets each of the given Vec4f[6] out to Plane#toVec4f(Vec4f) in the order LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR. More...
 
void getPlanes (final float[] out, final int off)
 Sets the given [float[off]..float[off+4*6]) out to ( n, d ). More...
 
final void updateByPlanes (final Plane[] src)
 Copy the given src planes into this this instance's planes. More...
 
Matrix4f updateByFovDesc (final Matrix4f m, final FovDesc fovDesc)
 Calculate the frustum planes in world coordinates using the passed FovDesc. More...
 
Frustum setFromMat (final Matrix4f pmv)
 Calculate the frustum planes in world coordinates using the passed column major order matrix, usually a projection (P) or premultiplied P*MV matrix. More...
 
Frustum updateFrustumPlanes (final Cube c)
 Calculate the frustum planes using the given Cube. More...
 
final boolean isOutside (final AABBox box)
 Returns whether the given AABBox is completely outside of this frustum. More...
 
final boolean isOutside (final Cube c)
 Returns whether the given Cube is completely outside of this frustum. More...
 
final Location classifyPoint (final Vec3f p)
 Classifies the given Vec3f point whether it is outside, inside or on a plane of this frustum. More...
 
final boolean isOutside (final Vec3f p)
 Returns whether the given Vec3f point is completely outside of this frustum. More...
 
final Location classifySphere (final Vec3f p, final float radius)
 Classifies the given sphere whether it is is outside, intersecting or inside of this frustum. More...
 
final boolean isSphereOutside (final Vec3f p, final float radius)
 Returns whether the given sphere is completely outside of this frustum. More...
 
StringBuilder toString (StringBuilder sb)
 
String toString ()
 

Static Public Attributes

static final int LEFT = 0
 Index for left plane: {@value}. More...
 
static final int RIGHT = 1
 Index for right plane: {@value}. More...
 
static final int BOTTOM = 2
 Index for bottom plane: {@value}. More...
 
static final int TOP = 3
 Index for top plane: {@value}. More...
 
static final int NEAR = 4
 Index for near plane: {@value}. More...
 
static final int FAR = 5
 Index for far plane: {@value}. More...
 

Protected Attributes

final Plane[] planes = new Plane[6]
 Normalized planes[l, r, b, t, n, f]. More...
 

Detailed Description

Providing frustum planes derived by different inputs (P*MV, ..) used to classify objects.

and to test whether they are outside

Extracting the world-frustum planes from the P*Mv:

Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
  Gil Gribb ggrib.nosp@m.b@ra.nosp@m.venso.nosp@m.ft.c.nosp@m.om
  Klaus Hartmann k_har.nosp@m.tman.nosp@m.n@osn.nosp@m.abru.nosp@m.eck.n.nosp@m.etsu.nosp@m.rf.de
  http://graphics.cs.ucf.edu/cap4720/fall2008/plane_extraction.pdf

Classifying Point, Sphere and AABBox:

Efficient View Frustum Culling
  Daniel Sýkora sykor.nosp@m.ad@f.nosp@m.el.cv.nosp@m.ut.c.nosp@m.z
  Josef Jelínek jelin.nosp@m.ej1@.nosp@m.fel.c.nosp@m.vut..nosp@m.cz
  http://www.cg.tuwien.ac.at/hostings/cescg/CESCG-2002/DSykoraJJelinek/index.html
Lighthouse3d.com
http://www.lighthouse3d.com/tutorials/view-frustum-culling/

Fundamentals about Planes, Half-Spaces and Frustum-Culling:

Planes and Half-Spaces,  Max Wagner mwagn.nosp@m.er@d.nosp@m.igipe.nosp@m.n.ed.nosp@m.u
http://www.emeyex.com/site/tuts/PlanesHalfSpaces.pdf
Frustum Culling,  Max Wagner mwagn.nosp@m.er@d.nosp@m.igipe.nosp@m.n.ed.nosp@m.u
http://www.emeyex.com/site/tuts/FrustumCulling.pdf

Definition at line 81 of file Frustum.java.

Constructor & Destructor Documentation

◆ Frustum() [1/2]

com.jogamp.math.geom.Frustum.Frustum ( )

Creates an undefined instance w/o calculating the frustum.

Use one of the update(..) methods to set the planes.

See also
updateByPlanes(Plane[])
#updateFrustumPlanes(float[], int)

Definition at line 123 of file Frustum.java.

◆ Frustum() [2/2]

com.jogamp.math.geom.Frustum.Frustum ( final Frustum  o)

Definition at line 132 of file Frustum.java.

Member Function Documentation

◆ classifyPoint()

final Location com.jogamp.math.geom.Frustum.classifyPoint ( final Vec3f  p)

Classifies the given Vec3f point whether it is outside, inside or on a plane of this frustum.

Parameters
pthe point
Returns
Location of point related to frustum planes

Definition at line 468 of file Frustum.java.

Here is the call graph for this function:

◆ classifySphere()

final Location com.jogamp.math.geom.Frustum.classifySphere ( final Vec3f  p,
final float  radius 
)

Classifies the given sphere whether it is is outside, intersecting or inside of this frustum.

Parameters
pcenter of the sphere
radiusradius of the sphere
Returns
Location of point related to frustum planes

Definition at line 504 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlanes() [1/3]

final Plane[] com.jogamp.math.geom.Frustum.getPlanes ( )

Planes are ordered in the returned array as follows:

Plane's normals are pointing to the inside of the frustum in order to work w/ isOutside(..) methods.

Returns
array of normalized Planes, order see above.

Definition at line 289 of file Frustum.java.

Here is the caller graph for this function:

◆ getPlanes() [2/3]

void com.jogamp.math.geom.Frustum.getPlanes ( final float[]  out,
final int  off 
)

Sets the given [float[off]..float[off+4*6]) out to ( n, d ).

Sets each of the given [float[off]..float[off+4*6]) out to Plane#toFloats(float[], int), i.e. [n.x, n.y, n.z, d, ...].

Plane order is as follows: LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR.

Parameters
outthe float[off+4*6] output array
Returns
out for chaining

Definition at line 317 of file Frustum.java.

Here is the call graph for this function:

◆ getPlanes() [3/3]

Vec4f[] com.jogamp.math.geom.Frustum.getPlanes ( final Vec4f[]  out)

Sets each of the given Vec4f[6] out to Plane#toVec4f(Vec4f) in the order LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR.

Parameters
outthe Vec4f[6] output array
Returns
out for chaining

Definition at line 297 of file Frustum.java.

Here is the call graph for this function:

◆ isOutside() [1/3]

final boolean com.jogamp.math.geom.Frustum.isOutside ( final AABBox  box)

Returns whether the given AABBox is completely outside of this frustum.

Note: If method returns false, the box may only be partially inside, i.e. intersects with this frustum

Definition at line 424 of file Frustum.java.

Here is the caller graph for this function:

◆ isOutside() [2/3]

final boolean com.jogamp.math.geom.Frustum.isOutside ( final Cube  c)

Returns whether the given Cube is completely outside of this frustum.

Note: If method returns false, the box may only be partially inside, i.e. intersects with this frustum

Definition at line 450 of file Frustum.java.

◆ isOutside() [3/3]

final boolean com.jogamp.math.geom.Frustum.isOutside ( final Vec3f  p)

Returns whether the given Vec3f point is completely outside of this frustum.

Parameters
pthe point
Returns
true if outside of the frustum, otherwise inside or on a plane

Definition at line 488 of file Frustum.java.

Here is the call graph for this function:

◆ isSphereOutside()

final boolean com.jogamp.math.geom.Frustum.isSphereOutside ( final Vec3f  p,
final float  radius 
)

Returns whether the given sphere is completely outside of this frustum.

Parameters
pcenter of the sphere
radiusradius of the sphere
Returns
true if outside of the frustum, otherwise inside or intersecting

Definition at line 527 of file Frustum.java.

Here is the call graph for this function:

◆ set()

Frustum com.jogamp.math.geom.Frustum.set ( final Frustum  o)

Definition at line 141 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFromMat()

Frustum com.jogamp.math.geom.Frustum.setFromMat ( final Matrix4f  pmv)

Calculate the frustum planes in world coordinates using the passed column major order matrix, usually a projection (P) or premultiplied P*MV matrix.

Frustum plane's normals will point to the inside of the viewing frustum, as required by this class.

See also
Matrix4f::getFrustum(Frustum)

Definition at line 378 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [1/2]

String com.jogamp.math.geom.Frustum.toString ( )

Definition at line 547 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [2/2]

StringBuilder com.jogamp.math.geom.Frustum.toString ( StringBuilder  sb)

Definition at line 531 of file Frustum.java.

◆ updateByFovDesc()

Matrix4f com.jogamp.math.geom.Frustum.updateByFovDesc ( final Matrix4f  m,
final FovDesc  fovDesc 
)

Calculate the frustum planes in world coordinates using the passed FovDesc.

Operation Details:

Frustum plane's normals will point to the inside of the viewing frustum, as required by this class.

Parameters
m4x4 matrix in column-major order (also result)
fovDescFrustum FovDesc
Returns
given matrix for chaining
See also
Matrix4f::setToPerspective(FovHVHalves, float, float)
Matrix4f::getFrustum(Frustum)
Matrix4f::getFrustum(Frustum, FovDesc)

Definition at line 363 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateByPlanes()

final void com.jogamp.math.geom.Frustum.updateByPlanes ( final Plane[]  src)

Copy the given src planes into this this instance's planes.

Parameters
srcthe 6 source planes

Definition at line 330 of file Frustum.java.

◆ updateFrustumPlanes()

Frustum com.jogamp.math.geom.Frustum.updateFrustumPlanes ( final Cube  c)

Calculate the frustum planes using the given Cube.

One useful application is to transform an AABBox, see Cube#Cube(AABBox) from its object-space into model-view (Mv) and produce the Frustum planes using this method for CPU side object culling and GPU shader side fragment clipping.

Frustum plane's normals will point to the inside of the viewing frustum, as required by this class.

Parameters
cthe Cube source
Returns
this frustum for chaining
See also
Cube::updateFrustumPlanes(Frustum)
Cube::Cube(AABBox)
Cube::transform(Matrix4f)

Definition at line 400 of file Frustum.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ BOTTOM

final int com.jogamp.math.geom.Frustum.BOTTOM = 2
static

Index for bottom plane: {@value}.

Definition at line 264 of file Frustum.java.

◆ FAR

final int com.jogamp.math.geom.Frustum.FAR = 5
static

Index for far plane: {@value}.

Definition at line 270 of file Frustum.java.

◆ LEFT

final int com.jogamp.math.geom.Frustum.LEFT = 0
static

Index for left plane: {@value}.

Definition at line 260 of file Frustum.java.

◆ NEAR

final int com.jogamp.math.geom.Frustum.NEAR = 4
static

Index for near plane: {@value}.

Definition at line 268 of file Frustum.java.

◆ planes

final Plane [] com.jogamp.math.geom.Frustum.planes = new Plane[6]
protected

Normalized planes[l, r, b, t, n, f].

Definition at line 113 of file Frustum.java.

◆ RIGHT

final int com.jogamp.math.geom.Frustum.RIGHT = 1
static

Index for right plane: {@value}.

Definition at line 262 of file Frustum.java.

◆ TOP

final int com.jogamp.math.geom.Frustum.TOP = 3
static

Index for top plane: {@value}.

Definition at line 266 of file Frustum.java.


The documentation for this class was generated from the following file: