Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: IsInFrustum implementation

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    656

    IsInFrustum implementation

    Hi All,

    Anybody can help me to understand what the 'findOpposingPointsMostPerpendicularToPlane' function does in this code snippet? Does it check the distance of each corner (8 times) of the AABB from the frustum plane and returns the min and max one?

    http://stackoverflow.com/questions/9...-is-really-big

    Thanks,

    Alberto

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: IsInFrustum implementation

    Quote Originally Posted by devdept
    Anybody can help me to understand what the 'findOpposingPointsMostPerpendicularToPlane' function does in this code snippet?
    I think what it's doing is returning 2 AABB corners: one which is the furthest along the positive direction of the plane normal, and one which is the furthest along the negative direction of the plane normal.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    656

    Re: IsInFrustum implementation

    Thanks Dark Photon,

    In this case they are computing 8 signed distance and sorting them, it's quite expensive...

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: IsInFrustum implementation

    Quote Originally Posted by devdept
    In this case they are computing 8 signed distance and sorting them, it's quite expensive...
    They could, but that'd be very inefficient.

    For instance, to find furthest positive point:
    Code :
      pt.x = (normal.x > 0) ? max.x : min.x;
      pt.y = (normal.y > 0) ? max.y : min.y;
      pt.z = (normal.z > 0) ? max.z : min.z;
    Make min/max a 2-element array and you can nuke the conditionals.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    656

    Re: IsInFrustum implementation

    Wow, I will try immediately...

    Thanks,

    Alberto

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •