com.jogamp.opengl.math

## Class FovHVHalves

- java.lang.Object
- - com.jogamp.opengl.math.FovHVHalves

-     public final class FovHVHalves
      extends Object

  Horizontal and vertical field of view (FOV) halves, allowing a non-centered projection.

  The values might be either in tangent or radians.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `float` | `bottom` Half vertical FOV from center to bottom.
    `boolean` | `inTangents` If true, values are in tangent, otherwise radians.
    `float` | `left` Half horizontal FOV from center to left.
    `float` | `right` Half horizontal FOV from center to right.
    `float` | `top` Half vertical FOV from center to top.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FovHVHalves(float left, float right, float top, float bottom, boolean inTangents)` Constructor for one `FovHVHalves` instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static FovHVHalves` | `byFovyRadianAndAspect(float verticalFov, float aspect)` Returns a symmetrical centered `FovHVHalves` instance in tangents, using:
    `static FovHVHalves` | `byFovyRadianAndAspect(float verticalFov, float vertCenterFromTop, float aspect, float horizCenterFromLeft)` Returns a custom symmetry `FovHVHalves` instance in tangents, via computing the `horizontalFov` using:
    `static FovHVHalves` | `byRadians(float horizontalFov, float verticalFov)` Returns a symmetrical centered `FovHVHalves` instance in tangents, using:
    `static FovHVHalves` | `byRadians(float horizontalFov, float horizCenterFromLeft, float verticalFov, float vertCenterFromTop)` Returns a custom symmetry `FovHVHalves` instance in tangents, using:
    `float` | `horzFov()` Returns the full horizontal FOV, i.e.
    `String` | `toString()`
    `String` | `toStringInDegrees()`
    `FovHVHalves` | `toTangents()` Returns this instance in tangent values.
    `float` | `vertFov()` Returns the full vertical FOV, i.e.

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### left

          public final float left

      Half horizontal FOV from center to left.

    - #### right

          public final float right

      Half horizontal FOV from center to right.

    - #### top

          public final float top

      Half vertical FOV from center to top.

    - #### bottom

          public final float bottom

      Half vertical FOV from center to bottom.

    - #### inTangents

          public final boolean inTangents

      If true, values are in tangent, otherwise radians.

  - ### Constructor Detail

    - #### FovHVHalves

          public FovHVHalves(float left,
                     float right,
                     float top,
                     float bottom,
                     boolean inTangents)

      Constructor for one `FovHVHalves` instance.

      It is recommended to pass and store values in tangent if used for perspective FOV calculations, since it will avoid conversion to tangent later on.

      Parameters:
        `left` - half horizontal FOV, left side, in tangent or radians
        `right` - half horizontal FOV, right side, in tangent or radians
        `top` - half vertical FOV, top side, in tangent or radians
        `bottom` - half vertical FOV, bottom side, in tangent or radians
        `inTangents` - if true, values are in tangent, otherwise radians

  - ### Method Detail

    - #### byRadians

          public static FovHVHalves byRadians(float horizontalFov,
                              float verticalFov)

      Returns a symmetrical centered `FovHVHalves` instance in tangents, using:

                  halfHorizFovTan = tan( horizontalFov / 2f );
                  halfVertFovTan  = tan( verticalFov / 2f );

      Parameters:
        `horizontalFov` - whole horizontal FOV in radians
        `verticalFov` - whole vertical FOV in radians

    - #### byFovyRadianAndAspect

          public static FovHVHalves byFovyRadianAndAspect(float verticalFov,
                                          float aspect)

      Returns a symmetrical centered `FovHVHalves` instance in tangents, using:

                  top  = bottom = tan( verticalFov / 2f );
                  left =  right = aspect * top;

      Parameters:
        `verticalFov` - vertical FOV in radians
        `aspect` - aspect ration width / height

    - #### byRadians

          public static FovHVHalves byRadians(float horizontalFov,
                              float horizCenterFromLeft,
                              float verticalFov,
                              float vertCenterFromTop)

      Returns a custom symmetry `FovHVHalves` instance in tangents, using:

                  left   = tan( horizontalFov * horizCenterFromLeft )
                  right  = tan( horizontalFov * ( 1f - horizCenterFromLeft ) )
                  top    = tan( verticalFov   * vertCenterFromTop )
                  bottom = tan( verticalFov   * (1f - vertCenterFromTop ) )

      Parameters:
        `horizontalFov` - whole horizontal FOV in radians
        `horizCenterFromLeft` - horizontal center from left in [0..1]
        `verticalFov` - whole vertical FOV in radians
        `vertCenterFromTop` - vertical center from top in [0..1]

    - #### byFovyRadianAndAspect

          public static FovHVHalves byFovyRadianAndAspect(float verticalFov,
                                          float vertCenterFromTop,
                                          float aspect,
                                          float horizCenterFromLeft)

      Returns a custom symmetry `FovHVHalves` instance in tangents, via computing the `horizontalFov` using:

                  halfVertFovTan  = tan( verticalFov / 2f );
                  halfHorizFovTan = aspect * halfVertFovTan;
                  horizontalFov   = atan( halfHorizFovTan ) * 2f;
                  return byRadians(horizontalFov, horizCenterFromLeft, verticalFov, vertCenterFromTop)

      Parameters:
        `verticalFov` - whole vertical FOV in radians
        `vertCenterFromTop` - vertical center from top in [0..1]
        `aspect` - aspect ration width / height
        `horizCenterFromLeft` - horizontal center from left in [0..1]

    - #### toTangents

          public final FovHVHalves toTangents()

      Returns this instance in tangent values.

      If this instance is `inTangents` already, method returns this instance, otherwise a newly created instance w/ converted values to tangent.

    - #### horzFov

          public final float horzFov()

      Returns the full horizontal FOV, i.e. `left` + `right`.

    - #### vertFov

          public final float vertFov()

      Returns the full vertical FOV, i.e. `top` + `bottom`.

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

    - #### toStringInDegrees

          public final String toStringInDegrees()

Copyright 2010 JogAmp Community.