Rise
The Vieneo Province
Toggle main menu visibility
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.
7
namespace
FlightLoads
{
8
struct
Limits
{
double
side
,
fore
,
normalBias
,
occupantNormal
,
airframeNormal
; };
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.
12
constexpr
Limits
Aerospace
={5,10,1,5,3.8};
13
constexpr
double
G
=0.00980665,
Side
=
Aerospace
.
side
,
Fore
=
Aerospace
.
fore
,
14
NormalBias
=
Aerospace
.
normalBias
,
Normal
=
Aerospace
.
occupantNormal
;
15
inline
double
WingExcursion
(
double
health) {
return
Aerospace
.
airframeNormal
*(std::clamp)(health,0.0,127.0)/127; }
16
inline
bool
OccupantExceeded
(
double
side,
double
normal,
double
fore) {
17
return
std::abs(side)>
Side
||std::abs(fore)>
Fore
||std::abs(normal-
NormalBias
)>
Normal
;
18
}
19
inline
double
NormalExcursion
(
double
left,
double
right) {
20
return
(std::min)({
Normal
,
WingExcursion
(left),
WingExcursion
(right)});
21
}
22
inline
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
}
FlightLoads
Definition
FlightLoads.h:7
FlightLoads::NormalBias
constexpr double NormalBias
Definition
FlightLoads.h:14
FlightLoads::NormalExcursion
double NormalExcursion(double left, double right)
Definition
FlightLoads.h:19
FlightLoads::WingExcursion
double WingExcursion(double health)
Definition
FlightLoads.h:15
FlightLoads::OccupantExceeded
bool OccupantExceeded(double side, double normal, double fore)
Definition
FlightLoads.h:16
FlightLoads::Fore
constexpr double Fore
Definition
FlightLoads.h:13
FlightLoads::G
constexpr double G
Definition
FlightLoads.h:13
FlightLoads::Normal
constexpr double Normal
Definition
FlightLoads.h:14
FlightLoads::Fraction
double Fraction(double side, double normal, double fore, double left, double right)
Definition
FlightLoads.h:22
FlightLoads::Aerospace
constexpr Limits Aerospace
Definition
FlightLoads.h:12
FlightLoads::Side
constexpr double Side
Definition
FlightLoads.h:13
FlightLoads::Limits
Definition
FlightLoads.h:8
FlightLoads::Limits::side
double side
Definition
FlightLoads.h:8
FlightLoads::Limits::fore
double fore
Definition
FlightLoads.h:8
FlightLoads::Limits::normalBias
double normalBias
Definition
FlightLoads.h:8
FlightLoads::Limits::airframeNormal
double airframeNormal
Definition
FlightLoads.h:8
FlightLoads::Limits::occupantNormal
double occupantNormal
Definition
FlightLoads.h:8
Viewscreen
FlightLoads.h
Generated on
for Rise by
1.18.0