Package com.jogamp.opengl.math
Class FovHVHalves
java.lang.Object
com.jogamp.opengl.math.FovHVHalves
Horizontal and vertical field of view (FOV) halves,
allowing a non-centered projection.
The values might be either in tangent or radians.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal floatHalf vertical FOV from center to bottom, either ininTangentsor radians.final booleanIf true, values are in tangent, otherwise radians.final floatHalf horizontal FOV from center to left, either ininTangentsor radians.final floatHalf horizontal FOV from center to right, either ininTangentsor radians.final floatHalf vertical FOV from center to top, either ininTangentsor radians. -
Constructor Summary
ConstructorsConstructorDescriptionFovHVHalves(float left, float right, float top, float bottom, boolean inTangents) Constructor for oneFovHVHalvesinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic FovHVHalvesbyFovyRadianAndAspect(float verticalFov, float aspect) Returns a symmetrical centeredFovHVHalvesinstance ininTangents, using:static FovHVHalvesbyFovyRadianAndAspect(float verticalFov, float vertCenterFromTop, float aspect, float horizCenterFromLeft) static FovHVHalvesbyRadians(float horizontalFov, float verticalFov) Returns a symmetrical centeredFovHVHalvesinstance ininTangents, using:static FovHVHalvesbyRadians(float horizontalFov, float horizCenterFromLeft, float verticalFov, float vertCenterFromTop) Returns a custom symmetryFovHVHalvesinstanceinTangents, using:final floathorzFov()Returns the full horizontal FOV, i.e.final StringtoString()final Stringfinal FovHVHalvesReturns this instance in tangent values.final floatvertFov()Returns the full vertical FOV, i.e.
-
Field Details
-
left
public final float leftHalf horizontal FOV from center to left, either ininTangentsor radians. -
right
public final float rightHalf horizontal FOV from center to right, either ininTangentsor radians. -
top
public final float topHalf vertical FOV from center to top, either ininTangentsor radians. -
bottom
public final float bottomHalf vertical FOV from center to bottom, either ininTangentsor radians. -
inTangents
public final boolean inTangentsIf true, values are in tangent, otherwise radians.
-
-
Constructor Details
-
FovHVHalves
public FovHVHalves(float left, float right, float top, float bottom, boolean inTangents) Constructor for oneFovHVHalvesinstance.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 radiansright- half horizontal FOV, right side, in tangent or radianstop- half vertical FOV, top side, in tangent or radiansbottom- half vertical FOV, bottom side, in tangent or radiansinTangents- if true, values are in tangent, otherwise radians
-
-
Method Details
-
byRadians
Returns a symmetrical centeredFovHVHalvesinstance ininTangents, using:halfHorizFovTan = tan( horizontalFov / 2f ); halfVertFovTan = tan( verticalFov / 2f );- Parameters:
horizontalFov- whole horizontal FOV in radiansverticalFov- whole vertical FOV in radians
-
byFovyRadianAndAspect
Returns a symmetrical centeredFovHVHalvesinstance ininTangents, using:top = bottom = tan( verticalFov / 2f ); left = right = aspect * top;- Parameters:
verticalFov- vertical FOV in radiansaspect- aspect ration width / height
-
byRadians
public static FovHVHalves byRadians(float horizontalFov, float horizCenterFromLeft, float verticalFov, float vertCenterFromTop) Returns a custom symmetryFovHVHalvesinstanceinTangents, 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 radianshorizCenterFromLeft- horizontal center from left in [0..1]verticalFov- whole vertical FOV in radiansvertCenterFromTop- vertical center from top in [0..1]
-
byFovyRadianAndAspect
public static FovHVHalves byFovyRadianAndAspect(float verticalFov, float vertCenterFromTop, float aspect, float horizCenterFromLeft) Returns a custom symmetryFovHVHalvesinstanceinTangents, via computing thehorizontalFovusing:halfVertFovTan = tan( verticalFov / 2f ); halfHorizFovTan = aspect * halfVertFovTan; horizontalFov = atan( halfHorizFovTan ) * 2f; returnbyRadians(horizontalFov, horizCenterFromLeft, verticalFov, vertCenterFromTop)- Parameters:
verticalFov- whole vertical FOV in radiansvertCenterFromTop- vertical center from top in [0..1]aspect- aspect ration width / heighthorizCenterFromLeft- horizontal center from left in [0..1]
-
toTangents
Returns this instance in tangent values.If this instance is
inTangentsalready, method returns this instance, otherwise a newly created instance w/ converted values to tangent. -
horzFov
public final float horzFov() -
vertFov
public final float vertFov() -
toString
-
toStringInDegrees
-