public class TLspFrustum extends Object
ILspView
, and
can hence be used to perform culling of invisible objects. To this effect,
this class contains overlap tests for the frustum with shapes such as points
and bounds.
The figure below shows a schematic view of a frustum. The frustum itself is defined by the thick
lines. With relation to a scene that is drawn in an ILspView
,
all objects that are located inside the volume defined by those thick lines, will appear on the
screen. All the objects that are outside these bounds will be culled.
Modifier and Type | Method and Description |
---|---|
static TLspFrustum |
createFromModelViewProjectionMatrix(double[][] aMVPMatrix)
Creates a frustum, based on the given modelview/projection matrix.
|
static TLspFrustum |
createFromViewRectangle(Rectangle aViewRectangle,
ALspViewXYZWorldTransformation aViewXYZWorldTransformation)
Creates a frustum, based on the given rectangle in view coordinates and the given view to world transformation.
|
ILcdBounds |
getBounds()
Gets the bounds of the frustum.
|
List<ILcdPoint> |
getCorners()
Gets the 8 corners of this frustum.
|
double[][] |
getPlanes()
Gets the 6 planes that bounds this frustum.
|
double[] |
getPlaneSFCT(int aIndex,
double[] aCoefficientsSFCT)
Returns the plane equation coefficients for a particular side of the
frustum.
|
boolean |
isBoundsVisible(ILcdBounds aBounds)
Checks whether the given bounds (in world coordinates) are visible in this frustum.
|
boolean |
isPointVisible(ILcdPoint aPoint)
Checks whether the given point (in world coordinates) is visible in this frustum.
|
String |
toString()
Returns a textual representation of this frustum.
|
public static TLspFrustum createFromModelViewProjectionMatrix(double[][] aMVPMatrix)
aMVPMatrix[row][column]
.aMVPMatrix
- the combined modelview and projection matrices for which to determine the frustum planesIllegalArgumentException
- when the given matrix is null
.public static TLspFrustum createFromViewRectangle(Rectangle aViewRectangle, ALspViewXYZWorldTransformation aViewXYZWorldTransformation)
aViewRectangle
- the rectangle around which to fit a frustumaViewXYZWorldTransformation
- the view to world transform for which to determine the frustumIllegalArgumentException
- when the given rectangle or view to world transformation are null
public String toString()
public boolean isBoundsVisible(ILcdBounds aBounds)
aBounds
- the bounds to be testedIllegalArgumentException
- when the given bounds are null
public boolean isPointVisible(ILcdPoint aPoint)
aPoint
- the point to be testedIllegalArgumentException
- when the given point is null
public double[] getPlaneSFCT(int aIndex, double[] aCoefficientsSFCT)
Ax + By + Cz + D = 0
, this
method returns the values of A
, B
, C
and D
in an array.
If aCoefficientsSFCT
is not null and has at least four
elements, it receives the coefficients. Otherwise, a new array is
allocated. This method returns the array into which the coefficients were
written.aIndex
- the index of the plane to be retrieved (between 0 and 5, inclusive)aCoefficientsSFCT
- if not null, receives the plane equation coefficients in its first
four elementsIllegalArgumentException
- when the given index is not in range [0, 5]
or when
aCoefficientsSFCT
is not null
and aCoefficientsSFCT.length < 4
public double[][] getPlanes()
Gets the 6 planes that bounds this frustum.
The result array should not be modified. To adapt the frustum, please create a new one using
createFromModelViewProjectionMatrix
or createFromViewRectangle
.
public List<ILcdPoint> getCorners()
computeFromModelViewProjectionMatrix(double[][])
or computeFromViewRectangle(java.awt.Rectangle, com.luciad.view.lightspeed.camera.ALspViewXYZWorldTransformation)
.public ILcdBounds getBounds()