Class Frustum


  • public class Frustum
    extends Object
    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 
       Klaus Hartmann 
       http://graphics.cs.ucf.edu/cap4720/fall2008/plane_extraction.pdf
     
    Classifying Point, Sphere and AABBox:
     Efficient View Frustum Culling
       Daniel Sýkora 
       Josef Jelínek 
       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 
     http://www.emeyex.com/site/tuts/PlanesHalfSpaces.pdf
     
     Frustum Culling,  Max Wagner 
     http://www.emeyex.com/site/tuts/FrustumCulling.pdf
     

    • Method Detail

      • updateByPlanes

        public final void updateByPlanes​(Frustum.Plane[] src)
        Copy the given src planes into this this instance's planes.
        Parameters:
        src - the 6 source planes
      • updateByPMV

        public void updateByPMV​(float[] pmv,
                                int pmv_off)
        Calculate the frustum planes in world coordinates using the passed float[16] as premultiplied P*MV (column major order).

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

      • isAABBoxOutside

        public final boolean isAABBoxOutside​(AABBox box)
        Check to see if an axis aligned bounding box is completely outside of the frustum.

        Note: If method returns false, the box may only be partially inside.

      • classifyPoint

        public final Frustum.Location classifyPoint​(float[] p)
        Check to see if a point is outside, inside or on a plane of the frustum.
        Parameters:
        p - the point
        Returns:
        Frustum.Location of point related to frustum planes
      • isPointOutside

        public final boolean isPointOutside​(float[] p)
        Check to see if a point is outside of the frustum.
        Parameters:
        p - the point
        Returns:
        true if outside of the frustum, otherwise inside or on a plane
      • classifySphere

        public final Frustum.Location classifySphere​(float[] p,
                                                     float radius)
        Check to see if a sphere is outside, intersecting or inside of the frustum.
        Parameters:
        p - center of the sphere
        radius - radius of the sphere
        Returns:
        Frustum.Location of point related to frustum planes
      • isSphereOutside

        public final boolean isSphereOutside​(float[] p,
                                             float radius)
        Check to see if a sphere is outside of the frustum.
        Parameters:
        p - center of the sphere
        radius - radius of the sphere
        Returns:
        true if outside of the frustum, otherwise inside or intersecting