10 using namespace swift::config;
11 using namespace swift::misc::aviation;
12 using namespace swift::misc::physical_quantities;
14 namespace swift::misc::simulation
16 CInterpolatorLinearPbh::CInterpolatorLinearPbh(
double simulationTimeFraction,
19 : m_simulationTimeFraction(simulationTimeFraction), m_startSituation(start), m_endSituation(
end)
21 if (CBuildConfig::isLocalDeveloperDebugBuild())
24 "Time fraction needs to be within [0;1]");
35 double deltaDeg = (
end -
begin).value(CAngleUnit::deg());
36 if (deltaDeg > 180.0) { deltaDeg -= 360; }
37 else if (deltaDeg < -180.0) { deltaDeg += 360; }
39 if (CBuildConfig::isLocalDeveloperDebugBuild())
41 SWIFT_VERIFY_X(isAcceptableTimeFraction(timeFraction0to1), Q_FUNC_INFO,
"0..1 fraction needed");
45 if (timeFraction0to1 >= 1.0) {
return begin +
CAngle(deltaDeg, CAngleUnit::deg()); }
46 if (timeFraction0to1 <= 0.0) {
return begin; }
47 return begin +
CAngle(timeFraction0to1 * deltaDeg, CAngleUnit::deg());
57 if (CBuildConfig::isLocalDeveloperDebugBuild())
60 "Need same reference");
62 return CHeading(interpolateAngle(headingStart, headingEnd, m_simulationTimeFraction),
69 return interpolateAngle(m_startSituation.
getPitch(), m_endSituation.
getPitch(), m_simulationTimeFraction);
75 return interpolateAngle(m_startSituation.
getBank(), m_endSituation.
getBank(), m_simulationTimeFraction);
86 if (CBuildConfig::isLocalDeveloperDebugBuild())
Value object encapsulating information of an aircraft's situation.
const CHeading & getHeading() const
Get heading.
const physical_quantities::CSpeed & getGroundSpeed() const
Get ground speed.
const physical_quantities::CAngle & getBank() const
Get bank (angle)
const physical_quantities::CAngle & getPitch() const
Get pitch.
Heading as used in aviation, can be true or magnetic heading.
ReferenceNorth getReferenceNorth() const
Get reference north (magnetic or true)
Physical unit angle (radians, degrees)
physical_quantities::CAngle getBank() const
Getter.
aviation::CHeading getHeading() const
Getter.
physical_quantities::CSpeed getGroundSpeed() const
Getter.
physical_quantities::CAngle getPitch() const
Getter.
void setTimeFraction(double tf)
Change time fraction.
bool isValidTimeFraction(double timeFraction)
Valid time fraction [0,1].
double clampValidTimeFraction(double timeFraction)
Clamp time fraction [0,1].
T::const_iterator begin(const LockFreeReader< T > &reader)
Non-member begin() and end() for so LockFree containers can be used in ranged for loops.
T::const_iterator end(const LockFreeReader< T > &reader)
Non-member begin() and end() for so LockFree containers can be used in ranged for loops.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.