public final class FovHVHalves extends Object
The values might be either in tangent or radians.
Modifier and Type | Field and Description |
---|---|
float |
bottom
Half vertical FOV from center to bottom, either in
inTangents or radians. |
boolean |
inTangents
If true, values are in tangent, otherwise radians.
|
float |
left
Half horizontal FOV from center to left, either in
inTangents or radians. |
float |
right
Half horizontal FOV from center to right, either in
inTangents or radians. |
float |
top
Half vertical FOV from center to top, either in
inTangents or radians. |
Constructor and Description |
---|
FovHVHalves(float left,
float right,
float top,
float bottom,
boolean inTangents)
Constructor for one
FovHVHalves instance. |
Modifier and Type | Method and Description |
---|---|
static FovHVHalves |
byFovyRadianAndAspect(float verticalFov,
float aspect)
Returns a symmetrical centered
FovHVHalves instance in inTangents , using: |
static FovHVHalves |
byFovyRadianAndAspect(float verticalFov,
float vertCenterFromTop,
float aspect,
float horizCenterFromLeft)
|
static FovHVHalves |
byRadians(float horizontalFov,
float verticalFov)
Returns a symmetrical centered
FovHVHalves instance in inTangents , using: |
static FovHVHalves |
byRadians(float horizontalFov,
float horizCenterFromLeft,
float verticalFov,
float vertCenterFromTop)
Returns a custom symmetry
FovHVHalves instance inTangents , 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.
|
public final float left
inTangents
or radians.public final float right
inTangents
or radians.public final float top
inTangents
or radians.public final float bottom
inTangents
or radians.public final boolean inTangents
public FovHVHalves(float left, float right, float top, float bottom, boolean inTangents)
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.
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 radianspublic static FovHVHalves byRadians(float horizontalFov, float verticalFov)
FovHVHalves
instance in inTangents
, using:
halfHorizFovTan = tan( horizontalFov / 2f ); halfVertFovTan = tan( verticalFov / 2f );
horizontalFov
- whole horizontal FOV in radiansverticalFov
- whole vertical FOV in radianspublic static FovHVHalves byFovyRadianAndAspect(float verticalFov, float aspect)
FovHVHalves
instance in inTangents
, using:
top = bottom = tan( verticalFov / 2f ); left = right = aspect * top;
verticalFov
- vertical FOV in radiansaspect
- aspect ration width / heightpublic static FovHVHalves byRadians(float horizontalFov, float horizCenterFromLeft, float verticalFov, float vertCenterFromTop)
FovHVHalves
instance inTangents
, using:
left = tan( horizontalFov * horizCenterFromLeft ) right = tan( horizontalFov * ( 1f - horizCenterFromLeft ) ) top = tan( verticalFov * vertCenterFromTop ) bottom = tan( verticalFov * (1f - vertCenterFromTop ) )
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]public static FovHVHalves byFovyRadianAndAspect(float verticalFov, float vertCenterFromTop, float aspect, float horizCenterFromLeft)
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)
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]public final FovHVHalves toTangents()
If this instance is inTangents
already, method returns this instance,
otherwise a newly created instance w/ converted values to tangent.
public final float horzFov()
public final float vertFov()
public final String toStringInDegrees()
Copyright 2010 JogAmp Community.