Class FrustumIntersection
matrix
.
This class is preferred over the frustum intersection methods in Matrix4fc
when many objects need to be culled by the same static frustum.
 Author:
 Kai Burjack

Field Summary
Modifier and TypeFieldDescriptionstatic final int
Return value ofintersectAab()
and its different overloads indicating that the axisaligned box is fully inside of the frustum.static final int
Return value ofintersectAab()
and its different overloads indicating that the axisaligned box intersects the frustum.static final int
Return value ofintersectSphere(Vector3fc, float)
orintersectSphere(float, float, float, float)
indicating that the sphere is completely outside of the frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationx=1
when using the identity frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationy=1
when using the identity frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationz=1
when using the identity frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationx=1
when using the identity frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationy=1
when using the identity frustum.static final int
The value in a bitmask forintersectAab()
that identifies the plane with equationz=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationx=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationy=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationz=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationx=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationy=1
when using the identity frustum.static final int
Return value ofintersectAab()
and its different overloads identifying the plane with equationz=1
when using the identity frustum. 
Constructor Summary
ConstructorDescriptionCreate a newFrustumIntersection
with undefined frustum planes.Create a newFrustumIntersection
from the givenmatrix
by extracing the matrix's frustum planes.FrustumIntersection
(Matrix4fc m, boolean allowTestSpheres) Create a newFrustumIntersection
from the givenmatrix
by extracing the matrix's frustum planes. 
Method Summary
Modifier and TypeMethodDescriptionfloat
distanceToPlane
(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int plane) Compute the signed distance from the given axisaligned box to theplane
.int
intersectAab
(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectAab
(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectAab
(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask, int startPlane) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectAab
(Vector3fc min, Vector3fc max) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectAab
(Vector3fc min, Vector3fc max, int mask) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectAab
(Vector3fc min, Vector3fc max, int mask, int startPlane) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler and, if the box is not inside this frustum, return the index of the plane that culled it.int
intersectSphere
(float x, float y, float z, float r) Determine whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.int
intersectSphere
(Vector3fc center, float radius) Determine whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.Update the stored frustum planes ofthis
FrustumIntersection
with the givenmatrix
and allow to optimize the frustum plane extraction in the case when no intersection test is needed for spheres.boolean
testAab
(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) Test whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
Test whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
testLineSegment
(float aX, float aY, float aZ, float bX, float bY, float bZ) Test whether the given line segment, defined by the end points(aX, aY, aZ)
and(bX, bY, bZ)
, is partly or completely within the frustum defined bythis
frustum culler.boolean
Test whether the given line segment, defined by the end pointsa
andb
, is partly or completely within the frustum defined bythis
frustum culler.boolean
testPlaneXY
(float minX, float minY, float maxX, float maxY) Test whether the given XYplane (atZ = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
testPlaneXY
(Vector2fc min, Vector2fc max) Test whether the given XYplane (atZ = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
testPlaneXZ
(float minX, float minZ, float maxX, float maxZ) Test whether the given XZplane (atY = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
testPoint
(float x, float y, float z) Test whether the given point(x, y, z)
is within the frustum defined bythis
frustum culler.boolean
Test whether the given point is within the frustum defined bythis
frustum culler.boolean
testSphere
(float x, float y, float z, float r) Test whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.boolean
testSphere
(Vector3fc center, float radius) Test whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.

Field Details

PLANE_NX
public static final int PLANE_NXReturn value ofintersectAab()
and its different overloads identifying the plane with equationx=1
when using the identity frustum. See Also:

PLANE_PX
public static final int PLANE_PXReturn value ofintersectAab()
and its different overloads identifying the plane with equationx=1
when using the identity frustum. See Also:

PLANE_NY
public static final int PLANE_NYReturn value ofintersectAab()
and its different overloads identifying the plane with equationy=1
when using the identity frustum. See Also:

PLANE_PY
public static final int PLANE_PYReturn value ofintersectAab()
and its different overloads identifying the plane with equationy=1
when using the identity frustum. See Also:

PLANE_NZ
public static final int PLANE_NZReturn value ofintersectAab()
and its different overloads identifying the plane with equationz=1
when using the identity frustum. See Also:

PLANE_PZ
public static final int PLANE_PZReturn value ofintersectAab()
and its different overloads identifying the plane with equationz=1
when using the identity frustum. See Also:

INTERSECT
public static final int INTERSECTReturn value ofintersectAab()
and its different overloads indicating that the axisaligned box intersects the frustum. See Also:

INSIDE
public static final int INSIDEReturn value ofintersectAab()
and its different overloads indicating that the axisaligned box is fully inside of the frustum. See Also:

OUTSIDE
public static final int OUTSIDEReturn value ofintersectSphere(Vector3fc, float)
orintersectSphere(float, float, float, float)
indicating that the sphere is completely outside of the frustum. See Also:

PLANE_MASK_NX
public static final int PLANE_MASK_NXThe value in a bitmask forintersectAab()
that identifies the plane with equationx=1
when using the identity frustum. See Also:

PLANE_MASK_PX
public static final int PLANE_MASK_PXThe value in a bitmask forintersectAab()
that identifies the plane with equationx=1
when using the identity frustum. See Also:

PLANE_MASK_NY
public static final int PLANE_MASK_NYThe value in a bitmask forintersectAab()
that identifies the plane with equationy=1
when using the identity frustum. See Also:

PLANE_MASK_PY
public static final int PLANE_MASK_PYThe value in a bitmask forintersectAab()
that identifies the plane with equationy=1
when using the identity frustum. See Also:

PLANE_MASK_NZ
public static final int PLANE_MASK_NZThe value in a bitmask forintersectAab()
that identifies the plane with equationz=1
when using the identity frustum. See Also:

PLANE_MASK_PZ
public static final int PLANE_MASK_PZThe value in a bitmask forintersectAab()
that identifies the plane with equationz=1
when using the identity frustum. See Also:


Constructor Details

FrustumIntersection
public FrustumIntersection()Create a newFrustumIntersection
with undefined frustum planes.Before using any of the frustum culling methods, make sure to define the frustum planes using
set(Matrix4fc)
. 
FrustumIntersection
Create a newFrustumIntersection
from the givenmatrix
by extracing the matrix's frustum planes.In order to update the compute frustum planes later on, call
set(Matrix4fc)
. Parameters:
m
 theMatrix4fc
to create the frustum culler from See Also:

FrustumIntersection
Create a newFrustumIntersection
from the givenmatrix
by extracing the matrix's frustum planes.In order to update the compute frustum planes later on, call
set(Matrix4fc)
. Parameters:
m
 theMatrix4fc
to create the frustum culler fromallowTestSpheres
 whether the methodstestSphere(Vector3fc, float)
,testSphere(float, float, float, float)
,intersectSphere(Vector3fc, float)
orintersectSphere(float, float, float, float)
will used. If no spheres need to be tested, thenfalse
should be used See Also:


Method Details

set
Update the stored frustum planes ofthis
FrustumIntersection
with the givenmatrix
.Reference: Fast Extraction of Viewing Frustum Planes from the WorldViewProjection Matrix
 Parameters:
m
 thematrix
to updatethis
frustum culler's frustum planes from Returns:
 this

set
Update the stored frustum planes ofthis
FrustumIntersection
with the givenmatrix
and allow to optimize the frustum plane extraction in the case when no intersection test is needed for spheres.Reference: Fast Extraction of Viewing Frustum Planes from the WorldViewProjection Matrix
 Parameters:
m
 thematrix
to updatethis
frustum culler's frustum planes fromallowTestSpheres
 whether the methodstestSphere(Vector3fc, float)
,testSphere(float, float, float, float)
,intersectSphere(Vector3fc, float)
orintersectSphere(float, float, float, float)
will be used. If no spheres need to be tested, thenfalse
should be used Returns:
 this

testPoint
Test whether the given point is within the frustum defined bythis
frustum culler. Parameters:
point
 the point to test Returns:
true
if the given point is inside the frustum;false
otherwise

testPoint
public boolean testPoint(float x, float y, float z) Test whether the given point(x, y, z)
is within the frustum defined bythis
frustum culler. Parameters:
x
 the xcoordinate of the pointy
 the ycoordinate of the pointz
 the zcoordinate of the point Returns:
true
if the given point is inside the frustum;false
otherwise

testSphere
Test whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for spheres that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
center
 the sphere's centerradius
 the sphere's radius Returns:
true
if the given sphere is partly or completely inside the frustum;false
otherwise

testSphere
public boolean testSphere(float x, float y, float z, float r) Test whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for spheres that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
x
 the xcoordinate of the sphere's centery
 the ycoordinate of the sphere's centerz
 the zcoordinate of the sphere's centerr
 the sphere's radius Returns:
true
if the given sphere is partly or completely inside the frustum;false
otherwise

intersectSphere
Determine whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for spheres that do not intersect the frustum. See iquilezles.org for an examination of this problem. 
intersectSphere
public int intersectSphere(float x, float y, float z, float r) Determine whether the given sphere is partly or completely within or outside of the frustum defined bythis
frustum culler.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for spheres that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
x
 the xcoordinate of the sphere's centery
 the ycoordinate of the sphere's centerz
 the zcoordinate of the sphere's centerr
 the sphere's radius Returns:
INSIDE
if the given sphere is completely inside the frustum, orINTERSECT
if the sphere intersects the frustum, orOUTSIDE
if the sphere is outside of the frustum

testAab
Test whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler. The box is specified via itsmin
andmax
corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
min
 the minimum corner coordinates of the axisaligned boxmax
 the maximum corner coordinates of the axisaligned box Returns:
true
if the axisaligned box is completely or partly inside of the frustum;false
otherwise

testAab
public boolean testAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) Test whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
frustum culler. The box is specified via its min and max corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum corner Returns:
true
if the axisaligned box is completely or partly inside of the frustum;false
otherwise

testPlaneXY
Test whether the given XYplane (atZ = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler. The plane is specified via itsmin
andmax
corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for planes that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
min
 the minimum corner coordinates of the XYplanemax
 the maximum corner coordinates of the XYplane Returns:
true
if the XYplane is completely or partly inside of the frustum;false
otherwise

testPlaneXY
public boolean testPlaneXY(float minX, float minY, float maxX, float maxY) Test whether the given XYplane (atZ = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler. The plane is specified via its min and max corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for planes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum corner Returns:
true
if the XYplane is completely or partly inside of the frustum;false
otherwise

testPlaneXZ
public boolean testPlaneXZ(float minX, float minZ, float maxX, float maxZ) Test whether the given XZplane (atY = 0
) is partly or completely within or outside of the frustum defined bythis
frustum culler. The plane is specified via its min and max corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
true
for planes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum corner Returns:
true
if the XZplane is completely or partly inside of the frustum;false
otherwise

intersectAab
Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 itsmin
andmax
corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
min
 the minimum corner coordinates of the axisaligned boxmax
 the maximum corner coordinates of the axisaligned box Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum;
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

intersectAab
public int intersectAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 min and max corner coordinates.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum corner Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum,
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

distanceToPlane
public float distanceToPlane(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int plane) Compute the signed distance from the given axisaligned box to theplane
. Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum cornerplane
 one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ
 Returns:
 the signed distance of the axisaligned box to the plane

intersectAab
Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 itsmin
andmax
corner coordinates.This method differs from
intersectAab(Vector3fc, Vector3fc)
in that it allows to maskoff planes that should not be calculated. For example, in order to only test a box against the left frustum plane, use a mask ofPLANE_MASK_NX
. Or in order to test all planes except the left plane, use a mask of(~0 ^ PLANE_MASK_NX)
.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
min
 the minimum corner coordinates of the axisaligned boxmax
 the maximum corner coordinates of the axisaligned boxmask
 contains as bitset all the planes that should be tested. This value can be any combination ofPLANE_MASK_NX
,PLANE_MASK_PX
,PLANE_MASK_NY
,PLANE_MASK_PY
,PLANE_MASK_NZ
andPLANE_MASK_PZ
 Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum,
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

intersectAab
public int intersectAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 min and max corner coordinates.This method differs from
intersectAab(float, float, float, float, float, float)
in that it allows to maskoff planes that should not be calculated. For example, in order to only test a box against the left frustum plane, use a mask ofPLANE_MASK_NX
. Or in order to test all planes except the left plane, use a mask of(~0 ^ PLANE_MASK_NX)
.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum cornermask
 contains as bitset all the planes that should be tested. This value can be any combination ofPLANE_MASK_NX
,PLANE_MASK_PX
,PLANE_MASK_NY
,PLANE_MASK_PY
,PLANE_MASK_NZ
andPLANE_MASK_PZ
 Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum,
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

intersectAab
Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 itsmin
andmax
corner coordinates.This method differs from
intersectAab(Vector3fc, Vector3fc)
in that it allows to maskoff planes that should not be calculated. For example, in order to only test a box against the left frustum plane, use a mask ofPLANE_MASK_NX
. Or in order to test all planes except the left plane, use a mask of(~0 ^ PLANE_MASK_NX)
.In addition, the
startPlane
denotes the first frustum plane to test the box against. To use this effectively means to store the plane that previously culled an axisaligned box (as returned byintersectAab()
) and in the next frame use the return value as the argument to thestartPlane
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.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem. Parameters:
min
 the minimum corner coordinates of the axisaligned boxmax
 the maximum corner coordinates of the axisaligned boxmask
 contains as bitset all the planes that should be tested. This value can be any combination ofPLANE_MASK_NX
,PLANE_MASK_PX
,PLANE_MASK_NY
,PLANE_MASK_PY
,PLANE_MASK_NZ
andPLANE_MASK_PZ
startPlane
 the first frustum plane to test the axisaligned box against. It is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ
 Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum,
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

intersectAab
public int intersectAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask, int startPlane) Determine whether the given axisaligned box is partly or completely within or outside of the frustum defined bythis
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 min and max corner coordinates.This method differs from
intersectAab(float, float, float, float, float, float)
in that it allows to maskoff planes that should not be calculated. For example, in order to only test a box against the left frustum plane, use a mask ofPLANE_MASK_NX
. Or in order to test all planes except the left plane, use a mask of(~0 ^ PLANE_MASK_NX)
.In addition, the
startPlane
denotes the first frustum plane to test the box against. To use this effectively means to store the plane that previously culled an axisaligned box (as returned byintersectAab()
) and in the next frame use the return value as the argument to thestartPlane
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.The algorithm implemented by this method is conservative. This means that in certain circumstances a false positive can occur, when the method returns
INTERSECT
for boxes that do not intersect the frustum. See iquilezles.org for an examination of this problem.Reference: Efficient View Frustum Culling
 Parameters:
minX
 the xcoordinate of the minimum cornerminY
 the ycoordinate of the minimum cornerminZ
 the zcoordinate of the minimum cornermaxX
 the xcoordinate of the maximum cornermaxY
 the ycoordinate of the maximum cornermaxZ
 the zcoordinate of the maximum cornermask
 contains as bitset all the planes that should be tested. This value can be any combination ofPLANE_MASK_NX
,PLANE_MASK_PX
,PLANE_MASK_NY
,PLANE_MASK_PY
,PLANE_MASK_NZ
andPLANE_MASK_PZ
startPlane
 the first frustum plane to test the axisaligned box against. It is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ
 Returns:
 the index of the first plane that culled the box, if the box does not intersect the frustum,
or
INTERSECT
if the box intersects the frustum, orINSIDE
if the box is fully inside of the frustum. The plane index is one ofPLANE_NX
,PLANE_PX
,PLANE_NY
,PLANE_PY
,PLANE_NZ
andPLANE_PZ

testLineSegment
Test whether the given line segment, defined by the end pointsa
andb
, is partly or completely within the frustum defined bythis
frustum culler. Parameters:
a
 the line segment's first end pointb
 the line segment's second end point Returns:
true
if the given line segment is partly or completely inside the frustum;false
otherwise

testLineSegment
public boolean testLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ) Test whether the given line segment, defined by the end points(aX, aY, aZ)
and(bX, bY, bZ)
, is partly or completely within the frustum defined bythis
frustum culler. Parameters:
aX
 the x coordinate of the line segment's first end pointaY
 the y coordinate of the line segment's first end pointaZ
 the z coordinate of the line segment's first end pointbX
 the x coordinate of the line segment's second end pointbY
 the y coordinate of the line segment's second end pointbZ
 the z coordinate of the line segment's second end point Returns:
true
if the given line segment is partly or completely inside the frustum;false
otherwise
