Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
jau::math::FovHVHalves Class Reference

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

#include <fov_hv_halves.hpp>

Collaboration diagram for jau::math::FovHVHalves:

Public Member Functions

constexpr FovHVHalves (const float left_, const float right_, const float top_, const float bottom_, const bool inTangents_) noexcept
 Constructor for one FovHVHalves instance. More...
 
constexpr FovHVHalves (const FovHVHalves &o) noexcept=default
 
constexpr FovHVHalves (FovHVHalves &&o) noexcept=default
 
float horzFov () const noexcept
 Returns the full horizontal FOV, i.e. More...
 
constexpr FovHVHalvesoperator= (const FovHVHalves &) noexcept=default
 
constexpr FovHVHalvesoperator= (FovHVHalves &&) noexcept=default
 
std::string toString () const noexcept
 
std::string toStringInDegrees () const noexcept
 
FovHVHalves toTangents () const noexcept
 Returns this instance in tangent values. More...
 
float vertFov () const noexcept
 Returns the full vertical FOV, i.e. More...
 

Static Public Member Functions

static FovHVHalves byFovyRadianAndAspect (const float verticalFov, const float aspect) noexcept
 Returns a symmetrical centered FovHVHalves instance in inTangents, using: More...
 
static FovHVHalves byFovyRadianAndAspect (const float verticalFov, const float vertCenterFromTop, const float aspect, const float horizCenterFromLeft) noexcept
 Returns a custom symmetry FovHVHalves instance inTangents, via computing the horizontalFov using: More...
 
static FovHVHalves byRadians (const float horizontalFov, const float horizCenterFromLeft, const float verticalFov, const float vertCenterFromTop) noexcept
 Returns a custom symmetry FovHVHalves instance inTangents, using: More...
 
static FovHVHalves byRadians (const float horizontalFov, const float verticalFov) noexcept
 Returns a symmetrical centered FovHVHalves instance in inTangents, using: More...
 

Public Attributes

float bottom
 Half vertical FOV from center to bottom, either in inTangents or radians. More...
 
bool inTangents
 If true, values are in tangent, otherwise radians. More...
 
float left
 Half horizontal FOV from center to left, either in inTangents or radians. More...
 
float right
 Half horizontal FOV from center to right, either in inTangents or radians. More...
 
float top
 Half vertical FOV from center to top, either in inTangents or radians. More...
 

Detailed Description

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

The values might be either in tangent or radians.

Definition at line 49 of file fov_hv_halves.hpp.

Constructor & Destructor Documentation

◆ FovHVHalves() [1/3]

constexpr jau::math::FovHVHalves::FovHVHalves ( const float  left_,
const float  right_,
const float  top_,
const float  bottom_,
const bool  inTangents_ 
)
inlineconstexprnoexcept

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

Definition at line 74 of file fov_hv_halves.hpp.

Here is the caller graph for this function:

◆ FovHVHalves() [2/3]

constexpr jau::math::FovHVHalves::FovHVHalves ( const FovHVHalves o)
constexprdefaultnoexcept

◆ FovHVHalves() [3/3]

constexpr jau::math::FovHVHalves::FovHVHalves ( FovHVHalves &&  o)
constexprdefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

constexpr FovHVHalves & jau::math::FovHVHalves::operator= ( const FovHVHalves )
constexprdefaultnoexcept

◆ operator=() [2/2]

constexpr FovHVHalves & jau::math::FovHVHalves::operator= ( FovHVHalves &&  )
constexprdefaultnoexcept

◆ byRadians() [1/2]

static FovHVHalves jau::math::FovHVHalves::byRadians ( const float  horizontalFov,
const float  verticalFov 
)
inlinestaticnoexcept

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

 halfHorizFovTan = tan( horizontalFov / 2f );
 halfVertFovTan  = tan( verticalFov / 2f );
Parameters
horizontalFovwhole horizontal FOV in radians
verticalFovwhole vertical FOV in radians

Definition at line 91 of file fov_hv_halves.hpp.

Here is the caller graph for this function:

◆ byFovyRadianAndAspect() [1/2]

static FovHVHalves jau::math::FovHVHalves::byFovyRadianAndAspect ( const float  verticalFov,
const float  aspect 
)
inlinestaticnoexcept

Returns a symmetrical centered FovHVHalves instance in inTangents, using:

 top  = bottom = tan( verticalFov / 2f );
 left =  right = aspect * top;
Parameters
verticalFovvertical FOV in radians
aspectaspect ration width / height

Definition at line 107 of file fov_hv_halves.hpp.

◆ byRadians() [2/2]

static FovHVHalves jau::math::FovHVHalves::byRadians ( const float  horizontalFov,
const float  horizCenterFromLeft,
const float  verticalFov,
const float  vertCenterFromTop 
)
inlinestaticnoexcept

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
horizontalFovwhole horizontal FOV in radians
horizCenterFromLefthorizontal center from left in [0..1]
verticalFovwhole vertical FOV in radians
vertCenterFromTopvertical center from top in [0..1]

Definition at line 127 of file fov_hv_halves.hpp.

◆ byFovyRadianAndAspect() [2/2]

static FovHVHalves jau::math::FovHVHalves::byFovyRadianAndAspect ( const float  verticalFov,
const float  vertCenterFromTop,
const float  aspect,
const float  horizCenterFromLeft 
)
inlinestaticnoexcept

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
verticalFovwhole vertical FOV in radians
vertCenterFromTopvertical center from top in [0..1]
aspectaspect ration width / height
horizCenterFromLefthorizontal center from left in [0..1]

Definition at line 150 of file fov_hv_halves.hpp.

◆ toTangents()

FovHVHalves jau::math::FovHVHalves::toTangents ( ) const
inlinenoexcept

Returns this instance in tangent values.

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

Definition at line 165 of file fov_hv_halves.hpp.

Here is the caller graph for this function:

◆ horzFov()

float jau::math::FovHVHalves::horzFov ( ) const
inlinenoexcept

Returns the full horizontal FOV, i.e.

left + right, either in inTangents or radians.

Definition at line 174 of file fov_hv_halves.hpp.

◆ vertFov()

float jau::math::FovHVHalves::vertFov ( ) const
inlinenoexcept

Returns the full vertical FOV, i.e.

top + bottom, either in inTangents or radians.

Definition at line 177 of file fov_hv_halves.hpp.

◆ toString()

std::string jau::math::FovHVHalves::toString ( ) const
inlinenoexcept

Definition at line 179 of file fov_hv_halves.hpp.

◆ toStringInDegrees()

std::string jau::math::FovHVHalves::toStringInDegrees ( ) const
inlinenoexcept

Definition at line 183 of file fov_hv_halves.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ left

float jau::math::FovHVHalves::left

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

Definition at line 52 of file fov_hv_halves.hpp.

◆ right

float jau::math::FovHVHalves::right

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

Definition at line 54 of file fov_hv_halves.hpp.

◆ top

float jau::math::FovHVHalves::top

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

Definition at line 56 of file fov_hv_halves.hpp.

◆ bottom

float jau::math::FovHVHalves::bottom

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

Definition at line 58 of file fov_hv_halves.hpp.

◆ inTangents

bool jau::math::FovHVHalves::inTangents

If true, values are in tangent, otherwise radians.

Definition at line 60 of file fov_hv_halves.hpp.


The documentation for this class was generated from the following file: