VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
snapshotHelpers.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2026 MAK Technologies, Inc.
3  * All rights reserved.
4  ******************************************************************************/
5 
6 #pragma once
7 
8 #include "dataTypes.h"
9 #include <matrix/geodeticCoord.h>
10 #include <matrix/topoCoord.h>
11 #include <matrix/vlMath.h>
13 #include <vrfutil/simResource.h>
14 #include <array>
15 #include <cmath>
16 #include <vector>
17 
20 {
21  std::array<double, 3> location = {};
22  double heading = 0.0;
23  double speed = 0.0;
24  double climbRate = 0.0;
25  double groundSpeed = 0.0;
26  double movementDirection = 0.0;
27 };
28 
32  const DtVector& worldPos,
33  const DtTaitBryan& worldOri,
34  const DtVector& worldVel)
35 {
37 
38  DtGeodeticCoord geod;
39  geod.setGeocentric(worldPos);
40  s.location[0] = DtRad2Deg(geod.lat());
41  s.location[1] = DtRad2Deg(geod.lon());
42  s.location[2] = geod.alt();
43 
44  DtCoordTransform geocToTopo;
45  DtGeocToTopoTransform(geod.lat(), geod.lon(), &geocToTopo);
46 
47  DtTaitBryan topoOri;
48  geocToTopo.eulerTrans(worldOri, &topoOri);
49  s.heading = std::fmod(DtRad2Deg(topoOri.psi()) + 360.0, 360.0);
50 
51  s.speed = std::sqrt(worldVel.magnitudeSquared());
52 
53  DtVector topoVel;
54  geocToTopo.vecTrans(worldVel, topoVel);
55  s.climbRate = topoVel.z() * -1.0;
56 
57  topoVel.setZ(0.0);
58  s.groundSpeed = std::sqrt(topoVel.magnitudeSquared());
59  s.movementDirection = std::fmod(DtRad2Deg(std::atan2(topoVel.y(), topoVel.x())) + 360.0, 360.0);
60 
61  return s;
62 }
63 
68  const std::vector<DtSimResource>& simResources,
69  const DtRemoteControlModelSetManager* dictionaryManager,
70  std::vector<DtDatasource::DtResourceEntry>& out);
All spatial fields that can be derived from ECEF position/orientation/velocity.
Definition: snapshotHelpers.h:19
std::array< double, 3 > location
[lat_deg, lon_deg, alt_m] WGS-84
Definition: snapshotHelpers.h:21
The DtRemoteControlModelSetManager class is used to lookup meta data regarding simulation model sets...
Definition: remoteControlModelSetManager.h:25
double speed
Total 3D speed in m/s.
Definition: snapshotHelpers.h:23
DtComputedSpatialState DtComputeSpatialState(const DtVector &worldPos, const DtTaitBryan &worldOri, const DtVector &worldVel)
Convert ECEF position, orientation and velocity to the standard WebLVC spatial state fields...
Definition: snapshotHelpers.h:31
void DtAppendResources(const std::vector< DtSimResource > &simResources, const DtRemoteControlModelSetManager *dictionaryManager, std::vector< DtDatasource::DtResourceEntry > &out)
Converts simResources into DtDatasource::DtResourceEntry objects and appends them to out...
double groundSpeed
Horizontal speed magnitude in m/s.
Definition: snapshotHelpers.h:25
double climbRate
Vertical velocity, m/s (positive = ascending)
Definition: snapshotHelpers.h:24
double movementDirection
Horizontal bearing of velocity, degrees clockwise from North.
Definition: snapshotHelpers.h:26
double heading
Compass bearing, degrees clockwise from North [0, 360)
Definition: snapshotHelpers.h:22

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)