com.io7m.jcanephora.core

## Class JCGLProjectionMatrices

- java.lang.Object
- - com.io7m.jcanephora.core.JCGLProjectionMatrices

- All Implemented Interfaces:
    JCGLProjectionMatricesType

      public final class JCGLProjectionMatrices
      extends Object
      implements JCGLProjectionMatricesType

  Functions to produce projection matrices. Memory for this implementation is allocated on creation of the class instance and reused.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `makeFrustumProjection(com.io7m.jtensors.MatrixWritable4x4FType 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.
    `void` | `makeOrthographicProjection(com.io7m.jtensors.MatrixWritable4x4FType 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.
    `void` | `makePerspectiveProjection(com.io7m.jtensors.MatrixWritable4x4FType 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.
    `static JCGLProjectionMatricesType` | `newMatrices()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### newMatrices

          public static JCGLProjectionMatricesType newMatrices()

      Returns:
        A `JCGLProjectionMatricesType` instance

    - #### makeFrustumProjection

          public void makeFrustumProjection(com.io7m.jtensors.MatrixWritable4x4FType matrix,
                                            double x_min,
                                            double x_max,
                                            double y_min,
                                            double y_max,
                                            double z_near,
                                            double z_far)

      Description copied from interface: `JCGLProjectionMatricesType`

      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

      Specified by:
        `makeFrustumProjection` in interface `JCGLProjectionMatricesType`
      Parameters:
        `matrix` - The matrix to which values will be written.
        `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.

    - #### makeOrthographicProjection

          public void makeOrthographicProjection(com.io7m.jtensors.MatrixWritable4x4FType matrix,
                                                 double x_min,
                                                 double x_max,
                                                 double y_min,
                                                 double y_max,
                                                 double z_near,
                                                 double z_far)

      Description copied from interface: `JCGLProjectionMatricesType`
      Calculate a projection matrix that produces an orthographic projection based on the given clipping plane coordinates.
      Specified by:
        `makeOrthographicProjection` in interface `JCGLProjectionMatricesType`
      Parameters:
        `matrix` - The matrix to which values will be written.
        `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.

    - #### makePerspectiveProjection

          public void makePerspectiveProjection(com.io7m.jtensors.MatrixWritable4x4FType matrix,
                                                double z_near,
                                                double z_far,
                                                double aspect,
                                                double horizontal_fov)

      Description copied from interface: `JCGLProjectionMatricesType`

      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

      Specified by:
        `makePerspectiveProjection` in interface `JCGLProjectionMatricesType`
      Parameters:
        `matrix` - The matrix to which values will be written.
        `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.

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