Class ProjectionMatrix

java.lang.Object
com.io7m.jcamera.examples.jogl.ProjectionMatrix

public final class ProjectionMatrix extends Object
Functions for producing projection matrices.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D
    frustumProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far)
    Calculate a matrix that produces a perspective projection.
    static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D
    orthographicProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far)
    Calculate a projection matrix that produces an orthographic projection based on the given clipping plane coordinates.
    static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D
    perspectiveProjectionRH(double z_near, double z_far, double aspect, double horizontal_fov)
    Calculate a matrix that will produce a perspective projection based on the given view frustum parameters, the aspect ratio of the viewport and a given horizontal field of view in radians.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • frustumProjectionRH

      public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D frustumProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far)

      Calculate a matrix that produces a perspective projection. The (x_min, y_min, z_near) and (x_max, y_max, z_near) parameters specify the points on the near clipping plane that are mapped to the lower-left and upper-right corners of the window, respectively, assuming that the eye is located at (0, 0, 0). The z_far parameter specifies the location of the far clipping plane.

      Note that iff z_far >= Double.POSITIVE_INFINITY, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.

      The function assumes a right-handed coordinate system.

      See GPU Gems

      Parameters:
      x_min - The minimum X clip plane
      x_max - The maximum X clip plane
      y_min - The minimum Y clip plane
      y_max - The maximum Y clip plane
      z_near - The near Z clip plane
      z_far - The far Z clip plane
      Returns:
      A frustum projection matrix
    • orthographicProjectionRH

      public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D orthographicProjectionRH(double x_min, double x_max, double y_min, double y_max, double z_near, double z_far)

      Calculate a projection matrix that produces an orthographic projection based on the given clipping plane coordinates.

      The function assumes a right-handed coordinate system.

      Parameters:
      x_min - The left clipping plane coordinate
      x_max - The right clipping plane coordinate
      y_min - The bottom clipping plane coordinate
      y_max - The top clipping plane coordinate
      z_near - The near clipping plane coordinate
      z_far - The far clipping plane coordinate
      Returns:
      An orthographic projection matrix
    • perspectiveProjectionRH

      public static com.io7m.jtensors.core.unparameterized.matrices.Matrix4x4D perspectiveProjectionRH(double z_near, double z_far, double aspect, double horizontal_fov)

      Calculate a matrix that will produce a perspective projection based on the given view frustum parameters, the aspect ratio of the viewport and a given horizontal field of view in radians. Note that fov_radians represents the full horizontal field of view: the angle at the base of the triangle formed by the frustum on the x/z plane.

      Note that iff z_far >= Double.POSITIVE_INFINITY, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.

      The function assumes a right-handed coordinate system.

      See GPU Gems

      Parameters:
      z_near - The near clipping plane coordinate
      z_far - The far clipping plane coordinate
      aspect - The aspect ratio of the viewport; the width divided by the height. For example, an aspect ratio of 2.0 indicates a viewport twice as wide as it is high
      horizontal_fov - The horizontal field of view in radians
      Returns:
      A perspective projection matrix