Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
GpwsWindshearSource.h
Go to the documentation of this file.
1
#pragma once
2
#include "
../GpwsPredictiveWindshear.h
"
3
#include "
../Protocol/TerrainWeather.h
"
4
5
namespace
GpwsPredictiveWindshear
6
{
7
template
<
class
Elevation>
Sample
SampleGrid
(
const
PlotWeather::Store
& source,
8
Vector3 position, Elevation elevation)
9
{
10
const
auto
& header = source.
Header
();
11
double
u,v;
PlotWeather::LocalSample
cell;
float
surface;
12
if
(!
PlotWeather::Coordinates
(position,header.cube,u,v) ||
13
!source.
Interpolate
(header.cube,u,v,header.requestToken,cell) ||
14
!elevation(header.cube,u,v,surface) || !std::isfinite(surface))
return
{};
15
Vector3 up = position;
16
if
(!
Unit
(up))
return
{};
17
// Same +Z north and rotation about -up as propulsion's ambient velocity
18
// TO. At the geographic poles bearing is undefined: report unavailable.
19
Vector3 north = Vector3(0,0,1)-up*up.z;
20
if
(!
Unit
(north))
return
{};
21
RiseMath::Matrix
rotation;
22
const
Vector3 axis = -up;
23
RiseMath::MatrixRotationAxis
(&rotation,&axis,cell.
surfaceWindDirectionRadians
);
24
Vector3 wind;
25
RiseMath::Vec3TransformNormal
(&wind,&north,&rotation);
26
wind *= cell.
surfaceWindSpeedMs
;
27
return
{wind,double(surface)*.001,
Finite
(wind)};
28
}
29
}
GpwsPredictiveWindshear.h
TerrainWeather.h
PlotWeather::Store
Definition
TerrainWeather.h:123
PlotWeather::Store::Interpolate
bool Interpolate(unsigned cube, double u, double v, uint16_t token, LocalSample &result) const
Definition
TerrainWeather.h:139
PlotWeather::Store::Header
const SPlotWeatherHeader & Header() const
Definition
TerrainWeather.h:130
GpwsPredictiveWindshear
Definition
GpwsPredictiveWindshear.h:9
GpwsPredictiveWindshear::SampleGrid
Sample SampleGrid(const PlotWeather::Store &source, Vector3 position, Elevation elevation)
Definition
GpwsWindshearSource.h:7
GpwsPredictiveWindshear::Finite
bool Finite(const Vector3 &v)
Definition
GpwsWindshear.h:12
GpwsPredictiveWindshear::Unit
bool Unit(Vector3 &v)
Definition
GpwsWindshear.h:15
PlotWeather::Coordinates
bool Coordinates(const RiseMath::Vector3 &position, unsigned cube, double &u, double &v)
Definition
TerrainWeather.h:100
RiseMath::Vec3TransformNormal
Vector3 * Vec3TransformNormal(Vector3 *out, const Vector3 *a, const Matrix *m)
Definition
ClientMath.h:107
RiseMath::MatrixRotationAxis
Matrix * MatrixRotationAxis(Matrix *out, const Vector3 *axis, float angle)
Definition
ClientMath.h:129
GpwsPredictiveWindshear::Sample
Definition
GpwsPredictiveWindshear.h:22
PlotWeather::LocalSample
Definition
TerrainWeather.h:91
PlotWeather::LocalSample::surfaceWindDirectionRadians
float surfaceWindDirectionRadians
Definition
TerrainWeather.h:95
PlotWeather::LocalSample::surfaceWindSpeedMs
float surfaceWindSpeedMs
Definition
TerrainWeather.h:95
RiseMath::Matrix
Definition
ClientMath.h:80
Modules
GpwsWindshearSource.h
Generated on
for Rise by
1.18.0