Package arc.math.geom
Class Frustum
java.lang.Object
arc.math.geom.Frustum
A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsBounds
(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth) boolean
containsBounds
(BoundingBox bounds) boolean
containsBounds
(Vec3 center, Vec3 dimensions) boolean
containsPoint
(float x, float y, float z) boolean
containsPoint
(Vec3 point) boolean
containsSphere
(float x, float y, float z, float radius) Returns whether the given sphere is in the frustum.boolean
containsSphere
(Vec3 center, float radius) boolean
containsSphereWithoutNearFar
(float x, float y, float z, float radius) boolean
containsSphereWithoutNearFar
(Vec3 center, float radius) void
Updates the clipping plane's based on the given inverse combined projection and view matrix.
-
Field Details
-
clipSpacePlanePoints
-
clipSpacePlanePointsArray
protected static final float[] 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 counterclockwise, starting at bottom left -
planePointsArray
protected final float[] planePointsArray
-
-
Constructor Details
-
Frustum
public Frustum()
-
-
Method Details
-
update
Updates the clipping plane's based on the given inverse combined projection and view matrix.- Parameters:
inverseProjectionView
- the combined projection and view matrices.
-
containsPoint
- Returns:
- whether the point is in the frustum.
-
containsPoint
public boolean containsPoint(float x, float y, float z) - 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.
-
containsSphere
- Parameters:
center
- The center of the sphereradius
- The radius of the sphere- Returns:
- whether the sphere is in the frustum
-
containsSphere
public boolean containsSphere(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
-
containsSphereWithoutNearFar
- Parameters:
center
- The center of the sphereradius
- The radius of the sphere- Returns:
- whether the sphere is in the frustum, not checking whether it is behind the near and far clipping plane.
-
containsSphereWithoutNearFar
public boolean containsSphereWithoutNearFar(float x, float y, float z, float radius) - 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, not checking whether it is behind the near and far clipping plane.
-
containsBounds
- Returns:
- Whether the bounding box is in the frustum
-
containsBounds
- Returns:
- Whether the bounding box is in the frustum
-
containsBounds
public boolean containsBounds(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth) - Returns:
- Whether the bounding box is in the frustum
-