...
 
Commits (6)
...@@ -21,7 +21,7 @@ endif () ...@@ -21,7 +21,7 @@ endif ()
if( NOT DEFINED ITA_BASE_WITH_FASTMATH_IPP ) if( NOT DEFINED ITA_BASE_WITH_FASTMATH_IPP )
set( ITA_BASE_WITH_FASTMATH_IPP OFF CACHE BOOL "Build with IPP implementation of fast math ops" ) set( ITA_BASE_WITH_FASTMATH_IPP OFF CACHE BOOL "Build with IPP implementation of fast math ops (requires license for redistribution)" )
endif( ) endif( )
if( NOT DEFINED ITA_BASE_WITH_FASTMATH_ASSEMBLER ) if( NOT DEFINED ITA_BASE_WITH_FASTMATH_ASSEMBLER )
...@@ -214,6 +214,9 @@ endif( ) ...@@ -214,6 +214,9 @@ endif( )
if( ITA_VISTA_BUILD_STATIC ) if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC ) add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
if( WIN32 )
list( APPEND VISTA_USE_PACKAGE_LIBRARIES Ws2_32 )
endif( )
endif( ) endif( )
if( NOT WIN32 ) if( NOT WIN32 )
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
...@@ -288,6 +288,9 @@ ITA_BASE_API float anglef_proj_0_360_DEG( const float alpha ); ...@@ -288,6 +288,9 @@ ITA_BASE_API float anglef_proj_0_360_DEG( const float alpha );
*/ */
ITA_BASE_API float anglef_proj_N180_180_DEG( const float alpha ); ITA_BASE_API float anglef_proj_N180_180_DEG( const float alpha );
//! Project an angle into interval of -90 and 90 degree
ITA_BASE_API float anglef_proj_N90_90_DEG( const float alpha );
//! (Gerichtete) minimale Winkeldifferenz für zwei Winkel [°] im Intervall [0°,360°) //! (Gerichtete) minimale Winkeldifferenz für zwei Winkel [°] im Intervall [0°,360°)
/** /**
* Für zwei gegebene Winkel 0°<= alpha, beta < 360° im Interval [0°,360°) berechnet * Für zwei gegebene Winkel 0°<= alpha, beta < 360° im Interval [0°,360°) berechnet
...@@ -324,27 +327,21 @@ ITA_BASE_API float anglef_mindiff_0_360_DEG( const float alpha, const float beta ...@@ -324,27 +327,21 @@ ITA_BASE_API float anglef_mindiff_0_360_DEG( const float alpha, const float beta
ITA_BASE_API float anglef_mindiff_abs_0_360_DEG( const float alpha, const float beta ); ITA_BASE_API float anglef_mindiff_abs_0_360_DEG( const float alpha, const float beta );
// Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß) //! Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const double yaw, const double pitch, const double roll, ITA_BASE_API void convertYPR2VU( const double yaw, const double pitch, const double roll, double& vx, double& vy, double& vz, double& ux, double& uy, double& uz );
double& vx, double& vy, double& vz,
double& ux, double& uy, double& uz );
// Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß) //! Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const float yaw, const float pitch, const float roll, ITA_BASE_API void convertYPR2VU( const float yaw, const float pitch, const float roll, float& vx, float& vy, float& vz, float& ux, float& uy, float& uz );
float& vx, float& vy, float& vz,
float& ux, float& uy, float& uz );
// Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß) // Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertVU2YPR( const double vx, const double vy, const double vz, ITA_BASE_API void convertVU2YPR( const double vx, const double vy, const double vz,
const double ux, const double uy, const double uz, const double ux, const double uy, const double uz,
double& yaw, double& pitch, double& roll ); double& yaw, double& pitch, double& roll );
// Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß) //! Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertVU2YPR( const float vx, const float vy, const float vz, ITA_BASE_API void convertVU2YPR( const float vx, const float vy, const float vz, const float ux, const float uy, const float uz, float& yaw, float& pitch, float& roll );
const float ux, const float uy, const float uz,
float& yaw, float& pitch, float& roll );
// Datenklasse für Fehlerwerte //! Datenklasse für Fehlerwerte
template< typename T > template< typename T >
class ITA_BASE_API ErrorValues class ITA_BASE_API ErrorValues
{ {
...@@ -363,7 +360,7 @@ public: ...@@ -363,7 +360,7 @@ public:
{}; {};
}; };
// Fehler zwischen zwei Vektoren berechnen //! Fehler zwischen zwei Vektoren berechnen
template< typename Tc, typename Ta, typename Tb > template< typename Tc, typename Ta, typename Tb >
inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int size ) inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int size )
{ {
...@@ -391,13 +388,8 @@ inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int s ...@@ -391,13 +388,8 @@ inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int s
return v; return v;
}; };
/* +-----------------------+
| |
| Listen und Folgen |
| |
+-----------------------+ */
// Fills a vector with numbers dest = { a+n*s < b | n in N } //! Fills a vector with numbers dest = { a+n*s < b | n in N }
template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T s = 1 ) template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T s = 1 )
{ {
dest.clear(); dest.clear();
...@@ -425,38 +417,40 @@ template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T ...@@ -425,38 +417,40 @@ template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T
} }
}; };
// Fills a vector with powers of two in the range a=2^i <= 2^j <= 2^k=b //! Fills a vector with powers of two in the range a=2^i <= 2^j <= 2^k=b
// (Note a and b must be powers of two, otherwise an exception is thrown) /**
* @note a and b must be powers of two, otherwise an exception is thrown)
*/
ITA_BASE_API void pow2space( std::vector< int >& dest, const int a, const int b ); ITA_BASE_API void pow2space( std::vector< int >& dest, const int a, const int b );
// returns the elevation angle (0 = frontal direction) in radians from a polar angle theta (0 = above) //! Returns the elevation angle (0 = frontal direction) in radians from a polar angle theta (0 = above)
ITA_BASE_API double theta2elevation(const double dThetaRAD); ITA_BASE_API double theta2elevation( const double dThetaRAD );
// returns the polar angle theta (0 = above) in radians from a given elevation angle (0 = frontal direction) //! returns the polar angle theta (0 = above) in radians from a given elevation angle (0 = frontal direction)
ITA_BASE_API double elevation2theta(const double dElevationRAD); ITA_BASE_API double elevation2theta( const double dElevationRAD );
// Calculates the factorial of an positive integer m // Calculates the factorial of an positive integer m
ITA_BASE_API int factorial( const int m ); ITA_BASE_API int factorial( const int m );
//Calculates the normalizing constant for SHRealvaluedBasefunctions //! Calculates the normalizing constant for SHRealvaluedBasefunctions
ITA_BASE_API double SHNormalizeConst( const int m, const int n ); ITA_BASE_API double SHNormalizeConst( const int m, const int n );
//Calculates the Kronecker delta //! Calculates the Kronecker delta
ITA_BASE_API int SHKronecker( const int m ); ITA_BASE_API int SHKronecker( const int m );
// Returns the linear index of a basefunction with degree m and order n, linear indexing starts with 0 //! Returns the linear index of a basefunction with degree m and order n, linear indexing starts with 0
ITA_BASE_API int SHDegreeOrder2Linear( const int m, const int n ); ITA_BASE_API int SHDegreeOrder2Linear( const int m, const int n );
// Returns degree and order of a basefunctions from a linear index, linear indexing starts with 0 //! Returns degree and order of a basefunctions from a linear index, linear indexing starts with 0
ITA_BASE_API void SHLinear2DegreeOrder(const int iLinear, int &m, int &n); ITA_BASE_API void SHLinear2DegreeOrder( const int iLinear, int &m, int &n );
// Calculates the remax weightings up to a given order //! Calculates the remax weightings up to a given order
ITA_BASE_API std::vector<double> HOARemaxWeights(int iTruncationOrder); ITA_BASE_API std::vector< double > HOARemaxWeights( int iTruncationOrder );
//Calculates the realvalued Basefunctions of SH for e.g. Ambisonics //! Calculates the realvalued Basefunctions of SH for e.g. Ambisonics
ITA_BASE_API std::vector<double> SHRealvaluedBasefunctions( const double thetaRAD, const double azimuthRAD, const int maxOrder ); ITA_BASE_API std::vector< double > SHRealvaluedBasefunctions( const double thetaRAD, const double azimuthRAD, const int maxOrder );
//Calculates the associated legendre polynomials //! Calculates the associated legendre polynomials
ITA_BASE_API std::vector<double> SHAssociatedLegendre( const int N, const double mu ); ITA_BASE_API std::vector< double > SHAssociatedLegendre( const int N, const double mu );
#endif // INCLUDE_WATCHER_ITA_NUMERIC_UTILS #endif // INCLUDE_WATCHER_ITA_NUMERIC_UTILS
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2018
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
......
...@@ -83,7 +83,7 @@ int uprmul( const int x, const int mul ) ...@@ -83,7 +83,7 @@ int uprmul( const int x, const int mul )
return ( r == 0 ? x : ( x > 0 ? x + mul - r : x - r ) ); return ( r == 0 ? x : ( x > 0 ? x + mul - r : x - r ) );
} }
unsigned int lwrmulu( const unsigned int x,const unsigned int mul ) unsigned int lwrmulu( const unsigned int x, const unsigned int mul )
{ {
return x - ( x % mul ); return x - ( x % mul );
} }
...@@ -242,7 +242,7 @@ void csargpabs( const float in_re, const float in_im, const float dest_arg, floa ...@@ -242,7 +242,7 @@ void csargpabs( const float in_re, const float in_im, const float dest_arg, floa
/* +----------- RAD -----------+ */ /* +----------- RAD -----------+ */
float anglef_proj_0_2PI( const float alpha ) float anglef_proj_0_2PI( const float alpha )
{ {
float alpha_temp= fmodf( alpha, 2 * PI_F ); float alpha_temp = fmodf( alpha, 2 * PI_F );
if( alpha_temp < 0 ) if( alpha_temp < 0 )
alpha_temp += 2 * PI_F; alpha_temp += 2 * PI_F;
return alpha_temp; return alpha_temp;
...@@ -254,6 +254,14 @@ float anglef_proj_NPI_PI( const float alpha ) ...@@ -254,6 +254,14 @@ float anglef_proj_NPI_PI( const float alpha )
return x; return x;
} }
float anglef_proj_NPIH_PIH( const float alpha )
{
float alpha_temp = fmodf( alpha + PI_F / 2.0f, PI_F ) - PI_F / 2.0f;
if( alpha_temp < -PI_F/2.0f )
alpha_temp += PI_F;
return alpha_temp;
}
float anglef_mindiff_0_2PI( const float alpha, const float beta ) float anglef_mindiff_0_2PI( const float alpha, const float beta )
{ {
float gamma = anglef_proj_0_2PI( beta ) - anglef_proj_0_2PI( alpha ); float gamma = anglef_proj_0_2PI( beta ) - anglef_proj_0_2PI( alpha );
...@@ -278,6 +286,10 @@ float anglef_proj_N180_180_DEG( const float alpha ) { ...@@ -278,6 +286,10 @@ float anglef_proj_N180_180_DEG( const float alpha ) {
return rad2gradf( anglef_proj_NPI_PI( grad2radf( alpha ) ) ); return rad2gradf( anglef_proj_NPI_PI( grad2radf( alpha ) ) );
} }
float anglef_proj_N90_90_DEG( const float alpha ) {
return rad2gradf( anglef_proj_NPIH_PIH( grad2radf( alpha ) ) );
}
float anglef_mindiff_0_360_DEG( const float alpha, const float beta ) float anglef_mindiff_0_360_DEG( const float alpha, const float beta )
{ {
return rad2gradf( anglef_mindiff_0_2PI( grad2radf( alpha ), grad2radf( beta ) ) ); return rad2gradf( anglef_mindiff_0_2PI( grad2radf( alpha ), grad2radf( beta ) ) );
...@@ -434,16 +446,32 @@ void pow2space( std::vector<int>& dest, const int a, const int b ) ...@@ -434,16 +446,32 @@ void pow2space( std::vector<int>& dest, const int a, const int b )
} }
} }
double theta2elevation( const double dThetaRAD )
{
if( dThetaRAD<0 || dThetaRAD>ITAConstants::PI_D )
ITA_EXCEPT1( INVALID_PARAMETER, "thetaRAD is only valid between 0 and PI" );
return ITAConstants::PI_D / 2.0f - dThetaRAD;
}
double elevation2theta( const double dElevationRAD )
{
if( abs( dElevationRAD ) < ITAConstants::PI_D / 2.0f )
ITA_EXCEPT1( INVALID_PARAMETER, "elevationRAD is only valid between -PI/2 and PI/2" );
return ITAConstants::PI_D / 2.0f - dElevationRAD;
}
int factorial( const int m ) int factorial( const int m )
{ {
if( m<0 ) if( m < 0 )
ITA_EXCEPT1( INVALID_PARAMETER, "Factorial can only be calculated for a positive integer" ); ITA_EXCEPT1( INVALID_PARAMETER, "Factorial can only be calculated for a positive integer" );
return ( m <= 1 ? 1 : m * factorial( m - 1 ) ); return ( m <= 1 ? 1 : m * factorial( m - 1 ) );
} }
double SHNormalizeConst( const int m, const int n ) double SHNormalizeConst( const int m, const int n )
{ {
if( m>n ) if( m > n )
ITA_EXCEPT1( INVALID_PARAMETER, "Abs(degree) cannot be greater than order" ); ITA_EXCEPT1( INVALID_PARAMETER, "Abs(degree) cannot be greater than order" );
double dRes = 0; double dRes = 0;
...@@ -452,7 +480,7 @@ double SHNormalizeConst( const int m, const int n ) ...@@ -452,7 +480,7 @@ double SHNormalizeConst( const int m, const int n )
else else
dRes = 1; dRes = 1;
dRes *= sqrt( ( 2.0f * n + 1 ) * ( 2.0f - SHKronecker( m ) ) * factorial( n - m ) / ( 4.0f * PI_F * factorial( n + m ) ) ); dRes *= sqrt( ( 2.0f * n + 1 ) * ( 2 - SHKronecker( m ) ) * double( factorial( n - m ) ) / ( 4.0f * PI_F * double( factorial( n + m ) ) ) );
return dRes; return dRes;
} }
...@@ -464,12 +492,13 @@ int SHKronecker( const int m ) ...@@ -464,12 +492,13 @@ int SHKronecker( const int m )
return 0; return 0;
} }
std::vector< double > SHRealvaluedBasefunctions( const double thetaRAD, const double azimuthRAD, const int maxOrder )
std::vector<double> SHRealvaluedBasefunctions( const double elevation_rad, const double azimuth_rad, const int maxOrder )
{ {
std::vector<double> Y; std::vector< double > Y;
Y.resize( ( maxOrder + 1 )*( maxOrder + 1 ) ); int nmax = ( maxOrder + 1 )*( maxOrder + 1 );
Y = SHAssociatedLegendre( maxOrder, cos( elevation_rad ) ); Y.resize( nmax );
Y = SHAssociatedLegendre( maxOrder, cos( thetaRAD ) );
for( int n = 0; n <= maxOrder; n++ ) for( int n = 0; n <= maxOrder; n++ )
{ {
...@@ -477,14 +506,13 @@ std::vector<double> SHRealvaluedBasefunctions( const double elevation_rad, const ...@@ -477,14 +506,13 @@ std::vector<double> SHRealvaluedBasefunctions( const double elevation_rad, const
for( int m = 1; m <= n; m++ ) for( int m = 1; m <= n; m++ )
{ {
double Normalizing = SHNormalizeConst( m, n ); double Normalizing = SHNormalizeConst( m, n );
Y[ SHDegreeOrder2Linear( m, n ) ] *= cos( m*azimuth_rad )*Normalizing; Y[ SHDegreeOrder2Linear( m, n ) ] *= cos( m*azimuthRAD )*Normalizing;
Y[ SHDegreeOrder2Linear( -m, n ) ] *= sin( m*azimuth_rad )*Normalizing; Y[ SHDegreeOrder2Linear( -m, n ) ] *= sin( m*azimuthRAD )*Normalizing;
} }
} }
return Y; return Y;
} }
std::vector<double> SHAssociatedLegendre( const int N, const double mu ) std::vector<double> SHAssociatedLegendre( const int N, const double mu )
{ {
std::vector< double > P; std::vector< double > P;
...@@ -516,3 +544,31 @@ int SHDegreeOrder2Linear( const int m, const int n ) ...@@ -516,3 +544,31 @@ int SHDegreeOrder2Linear( const int m, const int n )
return ( n*n + n + m ); return ( n*n + n + m );
} }
std::vector< double > HOARemaxWeights( int iTruncationOrder )
{
if( iTruncationOrder > 20 )
ITA_EXCEPT1( INVALID_PARAMETER, "ReMAx decoding only implemented up to Truncatrion Order 20" );
std::vector< double > vdRemax;
double dMaxRootTable[ 21 ] = { 0.993752, 0.993129, 0.992407, 0.991565, 0.990575, 0.989401, 0.987993, 0.986284, 0.984183, 0.978229, 0.978229, 0.973907, 0.96816, 0.96029, 0.949108, 0.93247, 0.90618, 0.861136, 0.774597, 0.57735, 0 };
double dMaxRoot = dMaxRootTable[ 21 - iTruncationOrder - 1 ];
std::vector< double > vdAssoLegendre = ( SHAssociatedLegendre( iTruncationOrder, dMaxRoot ) );
for( int k = 0; k <= iTruncationOrder; k++ )
{
vdRemax.push_back( vdAssoLegendre[ SHDegreeOrder2Linear( 0, k ) ] );
}
return vdRemax;
}
void SHLinear2DegreeOrder( const int iLinear, int &m, int &n )
{
if( iLinear < 0 )
ITA_EXCEPT1( INVALID_PARAMETER, "The linear index has to be higher than one" );
std::vector<int> nm;
n = ( int ) floor( sqrt( ( double ) iLinear ) );
m = ( iLinear - n * n - n );
}