DLL Project - Aircraft Wind XYZ Vector 3D

  • Hi,

    I'd like to have correct formula to calculate speed and direction wind from data 3D vector Aircraft.Wind in 3 components (U, V, W) or XYZ.

    I managed to calculate speed = _wind_speed = sqrt(pow(_wind.x,2.0) + pow(_wind.y,2.0) + pow(_wind.z,2.0));

    But to calculate direction, I don't found for the moment, I tried this formula : _wind_dir = (atan2(_wind.y, _wind.x)*180.0) / M_PI;



  • Wind velocity and aircraft position, velocity, etc. are all in global coordinates.

    You will need to create a projection of the wind vector onto the local east and north vectors (can be extracted from the global aircraft position using dot and cross products and either a round earth model or elliptical earth model - though round model would probably be good enough here).

    So you should have something like:

    wind_heading = 90.0 - ( atan2( wind * GetEastAt( position ), wind * GetNorthAt( position )) ) * 180.0 / PI

    Where the functions get east at and get north at return a 3d-vector perpendicular to the 3d position vector

    -> the 90 - angle because the mathematical angle starts at east and goes around counter clockwise where the compass rose starts at north and goes the other direction.

    By the way, you should prefer ( wind.x * wind.x ) over pow( wind.x, 2.0 ) which is more computational expensive or just use wind.Norm() (not sure if our vector function is available to you). I think you could also do sqrt( wind * wind ) if the vector dot product is defined to get the wind speed.

  • Hi Jan

    Thanks for this reply, in this line

    wind_heading = ( atan2( wind * GetEastAt( position ), wind * GetNorthAt( position )) ) * 180.0 / PI - 90.0

    I tried this formula but wind, GetEastAt and GetNorthAt return tm_vector3d variable.

    So for funtion atan2 need double variable.

    I don't know which x y or z I have to use.

    Sorry my lack of understanding.



  • I tried here but It is not exact.

    Message Aircraft.Wind :


    Message Aircraft.Position :


    1. double __wind_spd = sqrt(__wind.x*__wind.x + __wind.y*__wind.y + __wind.z*__wind.z); // m/s
    2. tm_vector3d east = __wind * tmcoordinates_GetEastAt(__position);
    3. tm_vector3d north = __wind * tmcoordinates_GetNorthAt(__position);
    4. __wind_cap = 90.0 - (atan2(east.x, north.y)) * 180.0 / M_PI;

    for 180° wind direction, __wind_cap gives me 57°, there is something wrong.