mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:10:04 +00:00 
			
		
		
		
	Add GetRadarBeamAltititude into geographic lib
This commit is contained in:
		
							parent
							
								
									22ed4c36fc
								
							
						
					
					
						commit
						b84c36c91a
					
				
					 2 changed files with 35 additions and 0 deletions
				
			
		|  | @ -2,6 +2,7 @@ | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <numbers> | #include <numbers> | ||||||
|  | #include <cmath> | ||||||
| 
 | 
 | ||||||
| #include <GeographicLib/Gnomonic.hpp> | #include <GeographicLib/Gnomonic.hpp> | ||||||
| #include <geos/algorithm/PointLocation.h> | #include <geos/algorithm/PointLocation.h> | ||||||
|  | @ -289,6 +290,25 @@ bool AreaInRangeOfPoint(const std::vector<common::Coordinate>& area, | ||||||
|     return GetDistanceAreaPoint(area, point) <= distance; |     return GetDistanceAreaPoint(area, point) <= distance; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | units::length::meters<double> | ||||||
|  | GetRadarBeamAltititude(units::length::meters<double> range, | ||||||
|  |                        units::angle::degrees<double> elevation, | ||||||
|  |                        units::length::meters<double> height) | ||||||
|  | { | ||||||
|  |    static const units::length::meters<double> earthRadius {6367444 * 4/3}; | ||||||
|  | 
 | ||||||
|  |    height += earthRadius; | ||||||
|  | 
 | ||||||
|  |    const double elevationRadians = | ||||||
|  |       units::angle::radians<double>(elevation).value(); | ||||||
|  |    const auto altitudeSquared = | ||||||
|  |       (range * range + height * height + | ||||||
|  |        2 * range * height * std::sin(elevationRadians)); | ||||||
|  | 
 | ||||||
|  |    return units::length::meters<double>(std::sqrt(altitudeSquared.value())) - | ||||||
|  |           earthRadius; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } // namespace GeographicLib
 | } // namespace GeographicLib
 | ||||||
| } // namespace util
 | } // namespace util
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
|  |  | ||||||
|  | @ -121,6 +121,21 @@ bool AreaInRangeOfPoint(const std::vector<common::Coordinate>& area, | ||||||
|                         const common::Coordinate&              point, |                         const common::Coordinate&              point, | ||||||
|                         const units::length::meters<double>    distance); |                         const units::length::meters<double>    distance); | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * Get the altitude of the radar beam at a given distance, elevation and height | ||||||
|  |  * | ||||||
|  |  * @param [in] range The range to the radar site | ||||||
|  |  * @param [in] elevation The elevation of the radar site | ||||||
|  |  * @param [in] height The height of the radar site | ||||||
|  |  * | ||||||
|  |  * @return The altitude of the radar at that range | ||||||
|  |  */ | ||||||
|  | units::length::meters<double> | ||||||
|  | GetRadarBeamAltititude(units::length::meters<double> range, | ||||||
|  |                        units::angle::degrees<double> elevation, | ||||||
|  |                        units::length::meters<double> height); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| } // namespace GeographicLib
 | } // namespace GeographicLib
 | ||||||
| } // namespace util
 | } // namespace util
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak