47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
|
#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_
|