Package gaiasky.util.math
Class FrustumDouble
java.lang.Object
gaiasky.util.math.FrustumDouble
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Vector3d[]
protected static final double[]
final Vector3d[]
eight points making up the near and far clipping "rectangles".protected final double[]
final PlaneDouble[]
the six clipping planes, near, far, left, right, top, bottom -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boundsInFrustum
(double x, double y, double z, double halfWidth, double halfHeight, double halfDepth) Returns whether the given bounding box is in the frustum.boolean
boundsInFrustum
(BoundingBoxDouble bounds) Returns whether the givenBoundingBoxDouble
is in the frustum.boolean
boundsInFrustum
(Vector3d center, Vector3d dimensions) Returns whether the given bounding box is in the frustum.boolean
pointInFrustum
(float x, float y, float z) Returns whether the point is in the frustum.boolean
pointInFrustum
(Vector3d point) Returns whether the point is in the frustum.boolean
sphereInFrustum
(float x, float y, float z, float radius) Returns whether the given sphere is in the frustum.boolean
sphereInFrustum
(Vector3d center, float radius) Returns whether the given sphere is in the frustum.boolean
sphereInFrustumWithoutNearFar
(float x, float y, float z, float radius) Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.boolean
sphereInFrustumWithoutNearFar
(Vector3d center, float radius) Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.void
Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g.
-
Field Details
-
clipSpacePlanePoints
-
clipSpacePlanePointsArray
protected static final double[] clipSpacePlanePointsArray -
planes
the six clipping planes, near, far, left, right, top, bottom -
planePoints
eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left -
planePointsArray
protected final double[] planePointsArray
-
-
Constructor Details
-
FrustumDouble
public FrustumDouble()
-
-
Method Details
-
update
Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from anOrthographicCamera
orPerspectiveCamera
.- Parameters:
inverseProjectionView
- the combined projection and view matrices.
-
pointInFrustum
Returns whether the point is in the frustum.- Parameters:
point
- The point- Returns:
- Whether the point is in the frustum.
-
pointInFrustum
public boolean pointInFrustum(float x, float y, float z) Returns whether the point is in the frustum.- Parameters:
x
- The X coordinate of the pointy
- The Y coordinate of the pointz
- The Z coordinate of the point- Returns:
- Whether the point is in the frustum.
-
sphereInFrustum
Returns whether the given sphere is in the frustum.- Parameters:
center
- The center of the sphereradius
- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustum
public boolean sphereInFrustum(float x, float y, float z, float radius) Returns whether the given sphere is in the frustum.- Parameters:
x
- The X coordinate of the center of the spherey
- The Y coordinate of the center of the spherez
- The Z coordinate of the center of the sphereradius
- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustumWithoutNearFar
Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.- Parameters:
center
- The center of the sphereradius
- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustumWithoutNearFar
public boolean sphereInFrustumWithoutNearFar(float x, float y, float z, float radius) Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.- Parameters:
x
- The X coordinate of the center of the spherey
- The Y coordinate of the center of the spherez
- The Z coordinate of the center of the sphereradius
- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
boundsInFrustum
Returns whether the givenBoundingBoxDouble
is in the frustum.- Parameters:
bounds
- The bounding box- Returns:
- Whether the bounding box is in the frustum
-
boundsInFrustum
Returns whether the given bounding box is in the frustum.- Returns:
- Whether the bounding box is in the frustum
-
boundsInFrustum
public boolean boundsInFrustum(double x, double y, double z, double halfWidth, double halfHeight, double halfDepth) Returns whether the given bounding box is in the frustum.- Returns:
- Whether the bounding box is in the frustum
-