Top Description Fields Constructors Methods
com.jogamp.opengl.math

public final Class FovHVHalves

extends Object
Class Inheritance

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

The values might be either in tangent or radians.

Field Summary

Modifier and TypeField and Description
public final float
bottom

Half vertical FOV from center to bottom, either in inTangents or radians.

public final boolean
inTangents

If true, values are in tangent, otherwise radians.

public final float
left

Half horizontal FOV from center to left, either in inTangents or radians.

public final float
right

Half horizontal FOV from center to right, either in inTangents or radians.

public final float
top

Half vertical FOV from center to top, either in inTangents or radians.

Constructor Summary

AccessConstructor and Description
public
FovHVHalves(final float
half horizontal FOV, left side, in tangent or radians
left
,
final float
half horizontal FOV, right side, in tangent or radians
right
,
final float
half vertical FOV, top side, in tangent or radians
top
,
final float
half vertical FOV, bottom side, in tangent or radians
bottom
,
final boolean
if true, values are in tangent, otherwise radians
inTangents
)

Constructor for one FovHVHalves instance.

Method Summary

Modifier and TypeMethod and Description
public static FovHVHalves
byFovyRadianAndAspect(final float
vertical FOV in radians
verticalFov
,
final float
aspect ration width / height
aspect
)

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

       top  = bottom = tan( verticalFov / 2f );
       left =  right = aspect * top;
public static FovHVHalves
byFovyRadianAndAspect(final float
whole vertical FOV in radians
verticalFov
,
final float
vertical center from top in [0..1]
vertCenterFromTop
,
final float
aspect ration width / height
aspect
,
final float
horizontal center from left in [0..1]
horizCenterFromLeft
)

Returns a custom symmetry FovHVHalves instance inTangents, via computing the horizontalFov using:

       halfVertFovTan  = tan( verticalFov / 2f );
       halfHorizFovTan = aspect * halfVertFovTan;
       horizontalFov   = atan( halfHorizFovTan ) * 2f;
       return byRadians(horizontalFov, horizCenterFromLeft, verticalFov, vertCenterFromTop)
public static FovHVHalves
byRadians(final float
whole horizontal FOV in radians
horizontalFov
,
final float
whole vertical FOV in radians
verticalFov
)

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

       halfHorizFovTan = tan( horizontalFov / 2f );
       halfVertFovTan  = tan( verticalFov / 2f );
public static FovHVHalves
byRadians(final float
whole horizontal FOV in radians
horizontalFov
,
final float
horizontal center from left in [0..1]
horizCenterFromLeft
,
final float
whole vertical FOV in radians
verticalFov
,
final float
vertical center from top in [0..1]
vertCenterFromTop
)

Returns a custom symmetry FovHVHalves instance inTangents, using:

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

Returns the full horizontal FOV, i.e. left + right, either in inTangents or radians.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public final String
public final FovHVHalves
toTangents()

Returns this instance in tangent values.

public final float
vertFov()

Returns the full vertical FOV, i.e. top + bottom, either in inTangents or radians.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bottomback to summary
public final float bottom

Half vertical FOV from center to bottom, either in inTangents or radians.

inTangentsback to summary
public final boolean inTangents

If true, values are in tangent, otherwise radians.

leftback to summary
public final float left

Half horizontal FOV from center to left, either in inTangents or radians.

topback to summary
public final float top

Half vertical FOV from center to top, either in inTangents or radians.

Constructor Detail

FovHVHalvesback to summary
public FovHVHalves(final float left, final float right, final float top, final float bottom, final 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:float

half horizontal FOV, left side, in tangent or radians

right:float

half horizontal FOV, right side, in tangent or radians

top:float

half vertical FOV, top side, in tangent or radians

bottom:float

half vertical FOV, bottom side, in tangent or radians

inTangents:boolean

if true, values are in tangent, otherwise radians

Method Detail

byFovyRadianAndAspectback to summary
public static FovHVHalves byFovyRadianAndAspect(final float verticalFov, final float aspect)

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

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

vertical FOV in radians

aspect:float

aspect ration width / height

byFovyRadianAndAspectback to summary
public static FovHVHalves byFovyRadianAndAspect(final float verticalFov, final float vertCenterFromTop, final float aspect, final float horizCenterFromLeft)

Returns a custom symmetry FovHVHalves instance inTangents, via computing the horizontalFov using:

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

whole vertical FOV in radians

vertCenterFromTop:float

vertical center from top in [0..1]

aspect:float

aspect ration width / height

horizCenterFromLeft:float

horizontal center from left in [0..1]

byRadiansback to summary
public static FovHVHalves byRadians(final float horizontalFov, final float verticalFov)

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

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

whole horizontal FOV in radians

verticalFov:float

whole vertical FOV in radians

byRadiansback to summary
public static FovHVHalves byRadians(final float horizontalFov, final float horizCenterFromLeft, final float verticalFov, final float vertCenterFromTop)

Returns a custom symmetry FovHVHalves instance inTangents, using:

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

whole horizontal FOV in radians

horizCenterFromLeft:float

horizontal center from left in [0..1]

verticalFov:float

whole vertical FOV in radians

vertCenterFromTop:float

vertical center from top in [0..1]

horzFovback to summary
public final float horzFov()

Returns the full horizontal FOV, i.e. left + right, either in inTangents or radians.

toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

toStringInDegreesback to summary
public final String toStringInDegrees()
toTangentsback to summary
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.

vertFovback to summary
public final float vertFov()

Returns the full vertical FOV, i.e. top + bottom, either in inTangents or radians.