Начало добавления математических функций

This commit is contained in:
2019-10-23 19:44:45 +03:00
parent 821bd88cee
commit 19aff9eb16
8 changed files with 247 additions and 0 deletions

46
src/myx/math/radar.hpp Normal file
View File

@@ -0,0 +1,46 @@
#ifndef MYX_MATH_RADAR_HPP_
#define MYX_MATH_RADAR_HPP_
#include <type_traits>
#include <cmath>
namespace myx {
namespace math {
/*!
* \brief geometric_target_visibility Геометрическая видимость цели
* \param earthRadius Радиус Земли
* \param antennaHeight Высота антенны
* \param targetHeight Высота цели
* \return Максимальная дальность видимости цели
*/
template < typename T >
T geometric_target_visibility( const T& earthRadius, const T& antennaHeight, const T& targetHeight )
{
// static_assert( std::is_arithmetic< T >::value || std::is_same< T, quantity< length_d > >::value, "Arithmetic type is required." );
static_assert( std::is_arithmetic< T >::value, "Arithmetic type is required." );
return ( sqrt( 2 * earthRadius * antennaHeight ) + sqrt( 2 * earthRadius * targetHeight ) );
}
/*!
* \brief radar_target_visibility Видимость цели по лучу
* \param earthRadius Радиус Земли
* \param antennaHeight Высота антенны
* \param targetHeight Высота цели
* \return Максимальная дальность видимости цели
*/
template < typename T >
T radar_target_visibility( T effectiveEarthRadius, T antennaHeight, T targetHeight )
{
// static_assert( std::is_arithmetic< T >::value || std::is_same< T, quantity< length_d > >::value, "Arithmetic type is required." );
static_assert( std::is_arithmetic< T >::value, "Arithmetic type is required." );
return ( sqrt( 2 * effectiveEarthRadius * antennaHeight ) + sqrt( 2 * effectiveEarthRadius * targetHeight ) );
}
} // namespace math
} // namespace myx
#endif // MYX_MATH_RADAR_HPP_