FrustumIntersection.intersectAab

Determine whether the given axis-aligned box is partly or completely within or outside of the frustum defined by <code>this</code> frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it. The box is specified via its <code>min</code> and <code>max</code> corner coordinates. <p> This method differs from {@link #intersectAab(Vector3d, Vector3d)} in that it allows to mask-off planes that should not be calculated. For example, in order to only test a box against the left frustum plane, use a mask of {@link #PLANE_MASK_NX}. Or in order to test all planes <i>except</i> the left plane, use a mask of <code>(~0 ^ PLANE_MASK_NX)</code>. <p> In addition, the <code>startPlane</code> denotes the first frustum plane to test the box against. To use this effectively means to store the plane that previously culled an axis-aligned box (as returned by <code>intersectAab()</code>) and in the next frame use the return value as the argument to the <code>startPlane</code> parameter of this method. The assumption is that the plane that culled the object previously will also cull it now (temporal coherency) and the culling computation is likely reduced in that case. <p> The algorithm implemented by this method is conservative. This means that in certain circumstances a <i>false positive</i> can occur, when the method returns {@link #INTERSECT} for boxes that do not intersect the frustum. See <a href="http://iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm">iquilezles.org</a> for an examination of this problem.

@param min the minimum corner coordinates of the axis-aligned box @param max the maximum corner coordinates of the axis-aligned box @param mask contains as bitset all the planes that should be tested. This value can be any combination of {@link #PLANE_MASK_NX}, {@link #PLANE_MASK_PX}, {@link #PLANE_MASK_NY}, {@link #PLANE_MASK_PY}, {@link #PLANE_MASK_NZ} and {@link #PLANE_MASK_PZ} @param startPlane the first frustum plane to test the axis-aligned box against. It is one of {@link #PLANE_NX}, {@link #PLANE_PX}, {@link #PLANE_NY}, {@link #PLANE_PY}, {@link #PLANE_NZ} and {@link #PLANE_PZ} @return the index of the first plane that culled the box, if the box does not intersect the frustum, or {@link #INTERSECT} if the box intersects the frustum, or {@link #INSIDE} if the box is fully inside of the frustum. The plane index is one of {@link #PLANE_NX}, {@link #PLANE_PX}, {@link #PLANE_NY}, {@link #PLANE_PY}, {@link #PLANE_NZ} and {@link #PLANE_PZ}

Meta