Начало добавления математических функций
This commit is contained in:
46
src/myx/math/radar.hpp
Normal file
46
src/myx/math/radar.hpp
Normal 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_
|
Reference in New Issue
Block a user