Package arc.math.geom

Class Frustum

java.lang.Object
arc.math.geom.Frustum

public class Frustum extends Object
A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
  • Field Details

    • clipSpacePlanePoints

      protected static final Vec3[] clipSpacePlanePoints
    • clipSpacePlanePointsArray

      protected static final float[] clipSpacePlanePointsArray
    • planes

      public final Plane[] planes
      the six clipping planes, near, far, left, right, top, bottom
    • planePoints

      public final Vec3[] 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

      public void update(Mat3D inverseProjectionView)
      Updates the clipping plane's based on the given inverse combined projection and view matrix.
      Parameters:
      inverseProjectionView - the combined projection and view matrices.
    • containsPoint

      public boolean containsPoint(Vec3 point)
      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 point
      y - The Y coordinate of the point
      z - The Z coordinate of the point
      Returns:
      whether the point is in the frustum.
    • containsSphere

      public boolean containsSphere(Vec3 center, float radius)
      Parameters:
      center - The center of the sphere
      radius - 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 sphere
      y - The Y coordinate of the center of the sphere
      z - The Z coordinate of the center of the sphere
      radius - The radius of the sphere
      Returns:
      whether the sphere is in the frustum
    • containsSphereWithoutNearFar

      public boolean containsSphereWithoutNearFar(Vec3 center, float radius)
      Parameters:
      center - The center of the sphere
      radius - 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 sphere
      y - The Y coordinate of the center of the sphere
      z - The Z coordinate of the center of the sphere
      radius - 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

      public boolean containsBounds(BoundingBox bounds)
      Returns:
      Whether the bounding box is in the frustum
    • containsBounds

      public boolean containsBounds(Vec3 center, Vec3 dimensions)
      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