com.io7m.jcamera.examples.jogl

## Class ProjectionMatrix

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

-     public final class ProjectionMatrix
      extends Object

  Functions for producing projection matrices.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `makeFrustumProjection(com.io7m.jtensors.Matrix4x4FType matrix, 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 void` | `makeOrthographicProjection(com.io7m.jtensors.Matrix4x4FType matrix, 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 void` | `makePerspectiveProjection(com.io7m.jtensors.Matrix4x4FType matrix, 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 Detail

    - #### makeFrustumProjection

          public static void makeFrustumProjection(com.io7m.jtensors.Matrix4x4FType matrix,
                                                   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 &gt;= Double .POSITIVE_INFINITY`, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.

      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.
        `matrix` - The matrix to which values will be written.

    - #### makeOrthographicProjection

          public static void makeOrthographicProjection(com.io7m.jtensors.Matrix4x4FType matrix,
                                                        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.
      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.
        `matrix` - The matrix to which values will be written.

    - #### makePerspectiveProjection

          public static void makePerspectiveProjection(com.io7m.jtensors.Matrix4x4FType matrix,
                                                       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 &gt;= Double.POSITIVE_INFINITY`, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.

      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.
        `matrix` - The matrix to which values will be written.

Copyright © 2016 <code@io7m.com> http://io7m.com