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?



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.

Thanks Dark Photon,

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:

  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.

Wow, I will try immediately…