Rise
The Vieneo Province
Loading...
Searching...
No Matches
FlightLoads.h
Go to the documentation of this file.
1#pragma once
2#include <algorithm>
3#include <cmath>
4
5// Existing client damage thresholds (framemove.cpp), expressed in standard G.
6// These are game-model limits, not human certification or Vieneo surface gravity.
7namespace FlightLoads {
9// One aerospace-class rating, shared with the damage model. No vehicle-ID
10// lookup or type-specific load rating. Health derates the common airframe
11// allowance; mass, lift and actuator performance remain vehicle-dependent.
12constexpr Limits Aerospace={5,10,1,5,3.8};
13constexpr double G=0.00980665, Side=Aerospace.side, Fore=Aerospace.fore,
15inline double WingExcursion(double health) { return Aerospace.airframeNormal*(std::clamp)(health,0.0,127.0)/127; }
16inline bool OccupantExceeded(double side,double normal,double fore) {
17 return std::abs(side)>Side||std::abs(fore)>Fore||std::abs(normal-NormalBias)>Normal;
18}
19inline double NormalExcursion(double left,double right) {
20 return (std::min)({Normal,WingExcursion(left),WingExcursion(right)});
21}
22inline double Fraction(double side,double normal,double fore,double left,double right) {
23 if(!std::isfinite(left)||!std::isfinite(right)||left<=0||right<=0||left>127||right>127) return INFINITY;
24 const double span=NormalExcursion(left,right);
25 if(!std::isfinite(side)||!std::isfinite(normal)||!std::isfinite(fore)||!(span>0)) return INFINITY;
26 return (std::max)({std::abs(side)/Side,std::abs(fore)/Fore,std::abs(normal-NormalBias)/span});
27}
28}
constexpr double NormalBias
Definition FlightLoads.h:14
double NormalExcursion(double left, double right)
Definition FlightLoads.h:19
double WingExcursion(double health)
Definition FlightLoads.h:15
bool OccupantExceeded(double side, double normal, double fore)
Definition FlightLoads.h:16
constexpr double Fore
Definition FlightLoads.h:13
constexpr double G
Definition FlightLoads.h:13
constexpr double Normal
Definition FlightLoads.h:14
double Fraction(double side, double normal, double fore, double left, double right)
Definition FlightLoads.h:22
constexpr Limits Aerospace
Definition FlightLoads.h:12
constexpr double Side
Definition FlightLoads.h:13