Rise
The Vieneo Province
Loading...
Searching...
No Matches
Tests/TerrainAwarenessSceneTests.cpp

Source at documentation-generation time. See Test catalog for fixture associations.

1#include "../Modules/Module.h"
2#include "../Rendering/FrameProfiler11.h"
3#include "../Viewscreen/GeometryBounds.h"
4#include <iostream>
5#include <memory>
6#include <chrono>
7#include <cstdlib>
8
11LOCALGRID2 gridarray[64][64];
13bool g_bAboveClouds = false;
14struct Logger::CrashState {};
15Logger::Logger() = default;
16Logger::~Logger() = default;
17void Logger::Log(const char*, Level, int) {}
18void Logger::AddToCallStack(const char*) {}
20// This scene suite exercises terrain acquisition; wind acquisition has its own production-adapter harness.
22
23// Only the GPU/stream ownership boundary is replaced. The code that gathers
24// obstacles and scans the live patch is extracted unchanged from production.
25struct FixtureZone
26{
27 std::vector<GeometryBounds> obstacleBounds;
28 std::vector<float> obstacleTops;
29 std::vector<s_mesh_component> componentarray;
30 RiseMath::Vector3 terpos{};
31};
32class SceneBuildings
33{
34public:
35 std::vector<FixtureZone> buildzones;
36 void CollectTerrainObstacles(std::vector<TerrainAwareness::Obstacle>& result) const;
37};
38struct grid {
39 Viewscreen* viewscreen = nullptr;
40 bool dataReady = true, geometryReady = true;
41 uint64_t revision = 1;
42 uint64_t ElevationRevision() const { return revision; }
43 void CalculateInsideArray(short t, short s) const;
44};
45class Viewscreen
46{
47public:
48 grid* ptrGrid;
49 SceneBuildings* ptrBuildings;
50 RiseMath::Vector3 forwardVector{0,1,0};
51 Logger* logger = nullptr;
52 RiseMath::Vector3 QuadraticVectorInterpolation(RiseMath::Vector3*,RiseMath::Vector3*,RiseMath::Vector3*,float) const;
53};
54#include "TerrainAwarenessScene.generated.h"
55
56static int checks = 0;
57static void Check(bool value, const char* message)
58{
59 ++checks;
60 if (!value) { std::cerr << "FAIL: " << message << '\n'; std::exit(1); }
61}
62static RiseMath::Vector3 Surface(float x, float y, float height = 0)
63{
64 const double r = double(radiusC)+height;
65 return {-x,-y,-float(std::sqrt(r*r-double(x)*x-double(y)*y))};
66}
67struct Fixture
68{
69 Logger logger;
70 std::unique_ptr<Bus> bus = std::make_unique<Bus>(&logger);
71 grid terrain;
72 SceneBuildings structures;
73 Viewscreen view{&terrain,&structures};
74 Gpws gpws{bus.get(),&logger,&view};
75 Fixture()
76 {
77 terrain.viewscreen = &view; view.logger = &logger;
79 playerships[0].position = -Surface(0,0,1); playerships[0].mslKm = 1;
80 // Include substantial planetary rotation: the predictor must remove it.
81 playerships[0].barycentric = {.3f,0,0}; playerships[0].velocity = {.3f,.1f,0};
84 bus->RadioAltitudeKm = 1; bus->VerticalSpeedKms = 0; bus->WPtargetC = 0;
85 for (int u = 0; u < 64; ++u) for (int v = 0; v < 64; ++v)
86 {
87 auto& cell = gridarray[u][v]; cell = {};
88 cell.tcp = {short(100+u),short(200+v)};
89 cell.pri_landform = 0; cell.elevationAvailable = true;
90 cell.position = Surface((u-31)*.5f,(v-31)*.5f);
91 }
92 Inside();
93 }
94 void Inside()
95 {
96 // Production only populates the inner subdivision cache.
97 for (auto& column : insidearray) for (auto& row : column) for (auto& p : row) p = {};
98 for (short u = 16; u < 48; ++u) for (short v = 16; v < 48; ++v)
99 terrain.CalculateInsideArray(u,v);
100 ++terrain.revision;
101 }
102 void Structure(float x, float y, float top, float halfWidth = .01f, unsigned char type = 1)
103 {
104 FixtureZone zone; GeometryBounds bounds;
105 zone.terpos = Surface(x,y);
106 bounds.Include(RiseMath::Vector3(-halfWidth,-halfWidth,-top));
107 bounds.Include(RiseMath::Vector3(halfWidth,halfWidth,0));
108 zone.obstacleBounds.push_back(bounds); zone.obstacleTops.push_back(top);
109 s_mesh_component component{}; component.type = type; component.boundsphere = top;
110 zone.componentarray.push_back(component); structures.buildzones.push_back(zone);
111 }
112 void Step() { gpws.FrameMove(.21f); }
113 void Approach(float distance, float height, float field = 0, float speed = .166f, float sink = -.012f)
114 {
115 playerships[0].position = -Surface(0,0,height); playerships[0].mslKm = height;
116 playerships[0].velocity = playerships[0].barycentric+RiseMath::Vector3(0,speed,0);
117 playerships[0].geardown = true;
118 bus->RadioAltitudeKm = height; bus->VerticalSpeedKms = sink; bus->HeadingTrackDegrees = 0;
119 bus->AFCS.CurrentLateralMode = Bus::Afcs::Localizer;
120 bus->AFCS.CurrentVerticalMode = Bus::Afcs::Glideslope;
121 Swaypoint target{}; target.type = 2; target.heading = 0; target.length = 2;
122 target.location = -Surface(0,distance,field); target.elevationKm = field; target.ils = 127;
123 bus->waypoint = {target}; bus->WPtargetC = 0;
124 }
125};
126#include "GpwsScenePerformance.h"
127#include "TerrainAlertStabilitySceneTests.h"
128int main(int argc, char** argv)
129{
130 if (argc == 2 && std::string(argv[1]) == "--benchmark") { BenchmarkGpwsScene(); return 0; }
131 TerrainAlertStabilitySceneRegressions();
133 Fixture f; f.Step();
134 Check(f.bus->GPWS.terrain.enabled && f.bus->GPWS.terrain.terrainComplete,"actual scene adapter reports full flat corridor");
135 Check(f.bus->GPWS.terrain.Alert() == Severity::None,"safe flat flight is quiet");
136 f.Structure(0,2.5f,1.2f); f.Step();
137 playerships[0].mslKm = 1.05f; f.gpws.FrameMove(.01f);
138 Check(f.bus->GPWS.terrain.altitudeKm == 1.05f,"each scheduled turn refreshes terrain without an independent 0.2-second gate");
139 playerships[0].mslKm = 1; f.Step();
140 Check(f.bus->GPWS.terrain.obstacle == Severity::Warning && f.bus->GPWS.Alert == Bus::Gpws::TA_Obstacle_Warning,"streamed tower ahead triggers obstacle warning using ground-relative velocity");
141 Check(f.bus->GPWS.terrain.obstacles.size() == 1,"individual obstacle reaches map");
142 const unsigned oldRevision = f.bus->GPWS.terrainRevision;
143 ++playerships[0].vehicleId; f.Step();
144 Check(f.bus->GPWS.terrainRevision != oldRevision,"vehicle change invalidates old speech even when the new hazard is identical");
145 f.structures.buildzones.clear(); f.Structure(3,2,1.2f); f.Step();
146 Check(f.bus->GPWS.terrain.obstacle == Severity::None,"off-track structure stays quiet");
147 f.structures.buildzones.clear(); f.Structure(0,2,.001f,.5f); f.Step();
148 Check(f.bus->GPWS.terrain.obstacles.empty(),"ground-level pavement is not an obstacle");
149 f.structures.buildzones.clear(); f.Structure(0,2,1.2f,.1f,8); f.Step();
150 Check(f.bus->GPWS.terrain.obstacles.empty(),"non-solid crop components excluded");
151 f.structures.buildzones.clear();
153 f.Step(); Check(!f.bus->GPWS.terrain.obstaclesComplete,"unreceived colony layout is unknown");
155 for (int u = 29; u <= 34; ++u) for (int v = 36; v <= 37; ++v)
156 gridarray[u][v].position = Surface((u-31)*.5f,(v-31)*.5f,1.1f);
157 f.Inside(); f.Step();
158 Check(f.bus->GPWS.terrain.terrain == Severity::Warning,"surface triangles ahead detect a ridge");
159 Check(f.bus->GPWS.terrain.cells[31*63+36].severity == Severity::Warning,"the specific hazardous cell is highlighted");
160 for (int u = 29; u <= 34; ++u) gridarray[u][36].elevationAvailable = false;
161 f.Step(); Check(!f.bus->GPWS.terrain.terrainComplete,"missing received elevation does not count as safe");
162 f.terrain.dataReady = false; f.Step();
163 Check(f.bus->GPWS.terrain.enabled && !f.bus->GPWS.terrain.terrainComplete && f.bus->GPWS.terrain.Alert() == Severity::None,"loading clears threats and shows unavailable coverage");
164 playerships[0].isSimulator = true; f.Step();
165 Check(!f.bus->GPWS.terrain.enabled && f.bus->GPWS.terrain.obstacles.empty(),"simulator admission clears production scene");
166 playerships[0].isSimulator = false; f.terrain.dataReady = true; f.Step();
167 Check(f.bus->GPWS.terrain.enabled,"real-world scene reacquired after simulator");
168 for (int u = 29; u <= 34; ++u) gridarray[u][36].elevationAvailable = true;
169 ++f.terrain.revision; f.terrain.geometryReady = false; f.Step();
170 Check(f.bus->GPWS.terrain.terrain == Severity::Warning,"GPU rebuild retains known hazards despite geometryReady being false");
171 f.terrain.geometryReady = true;
173 Check(f.bus->GPWS.terrain.enabled && f.bus->GPWS.terrain.Alert() == Severity::None,"hover retains map without invented forward collision");
174 const auto start = std::chrono::steady_clock::now();
175 for (int i = 0; i < 5; ++i) f.Step();
176 const auto elapsed = std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-start).count()/5;
177 std::cout << "PASS: " << checks << " production scene checks; " << elapsed << " ms per hover scan\n";
179 for (int i = 0; i < 200; ++i) f.Structure((i%20)*.1f-1,(i/20)*.1f+2,.2f);
180 const auto flightStart = std::chrono::steady_clock::now();
181 for (int i = 0; i < 5; ++i) f.Step();
182 std::cout << "200-building flight scan: " <<
183 std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-flightStart).count()/5 << " ms\n";
184
185 {
186 Fixture distant;
188 distant.Step();
189 Check(distant.bus->GPWS.terrain.terrainComplete,"coarse outer cells complete a corridor beyond the inner patch");
190 Check(distant.bus->GPWS.terrain.cells[31*63+60].valid,"outer elevation is valid without fine subdivisions");
191 for (int u = 29; u <= 34; ++u) for (int v = 54; v <= 55; ++v)
192 gridarray[u][v].position = Surface((u-31)*.5f,(v-31)*.5f,1.1f);
193 ++distant.terrain.revision; distant.terrain.geometryReady = false;
194 distant.gpws.FrameMove(.01f);
195 Check(distant.bus->GPWS.terrain.terrain == Severity::Warning,"high-speed 60-second / 8-nm warning scans new distant ridge is scanned immediately before graphics rebuild");
196 for (int u = 0; u < 64; ++u) for (int v = 0; v < 64; ++v) ++gridarray[u][v].tcp.u;
197 ++distant.terrain.revision; distant.gpws.FrameMove(.01f);
198 Check(distant.bus->GPWS.terrain.cells[31*63+54].u == gridarray[31][54].tcp.u &&
199 distant.bus->GPWS.terrain.cells[31*63+54].severity == Severity::Warning,
200 "changed grid identities rescan on the next module turn");
201 for (int u = 0; u < 64; ++u) gridarray[u][63].elevationAvailable = false;
202 ++distant.terrain.revision; distant.gpws.FrameMove(.01f);
203 Check(distant.bus->GPWS.terrain.cells[31*63+54].valid && !distant.bus->GPWS.terrain.cells[31*63+62].valid,
204 "missing streamed row invalidates only dependent cells");
205 }
206 {
207 Fixture departure;
208 for (int u = 29; u <= 34; ++u) for (int v = 36; v <= 37; ++v)
209 gridarray[u][v].position = Surface((u-31)*.5f,(v-31)*.5f,1.1f);
210 departure.Inside(); departure.Structure(0,2,1.2f); departure.Step();
211 Check(departure.bus->GPWS.terrain.Alert() == Severity::Warning,"departure fixture has a mountain and tower on flight path");
213 playerships[0].position = -Surface(0,0,.01f); playerships[0].mslKm = .01f;
214 departure.bus->RadioAltitudeKm = .01f;
215 // Ground transition is processed on the next scheduled module turn.
216 departure.gpws.FrameMove(.01f);
217 const auto& state = departure.bus->GPWS.terrain;
218 Check(state.enabled && state.onGround && state.Alert() == Severity::None && !state.obstacles.empty(),
219 "ground transition retains terrain and building data but clears predictive threats immediately");
220 Check(TerrainAwareness::Color(state.cells[31*63+36].topKm,state.altitudeKm,state.verticalKms,
221 state.gearDown,state.cells[31*63+36].severity,true,state.displayRunwayKm,state.onGround) == 0xffb03030,
222 "mountain remains relative red while aircraft is on the ground");
223 Check(!departure.bus->GPWS.IsTerrainAlert(),"taxi speed cannot trigger airborne predictive warnings");
224 playerships[0].reference = REF_APNMODE; departure.gpws.FrameMove(.01f);
225 Check(!state.onGround && state.Alert() == Severity::Warning,"liftoff immediately re-enables the actual threat scan");
226 departure.view.ptrBuildings = nullptr; departure.Step();
227 Check(!state.obstaclesComplete,"missing building provider reports incomplete data without dereferencing null");
228 }
229 {
230 Fixture fine;
231 gridarray[31][36].position = Surface(0,2.5f,2.f);
232 gridarray[32][36].position = Surface(.5f,2.5f,2.f);
233 ++fine.terrain.revision; fine.terrain.geometryReady = false; fine.Step();
234 Check(fine.bus->GPWS.terrain.cells[31*63+36].topKm > 2.02f,
235 "fresh fine interpolation peak is used instead of coarse corner maximum");
236 gridarray[16][36].position = Surface(-7.5f,2.5f,2.f);
237 ++fine.terrain.revision; fine.Step();
238 const auto expected = std::max({GeometricHeight(gridarray[16][36].position),
239 GeometricHeight(insidearray[16][36][0]),GeometricHeight(insidearray[17][36][1]),
240 GeometricHeight(insidearray[16][37][0])});
241 Check(std::fabs(fine.bus->GPWS.terrain.cells[16*63+36].topKm-expected) < .001f,
242 "fine/coarse seam follows renderer midpoints");
243 }
244 {
245 Fixture approach;
246 approach.bus->VerticalSpeedKms = -.018f; approach.Structure(0,4,1.1f);
247 approach.Step();
248 const auto& state = approach.bus->GPWS.terrain;
249 Check(state.terrain == Severity::Caution && state.obstacle == Severity::Caution && state.obstacleTime < state.terrainTime,
250 "colony obstacle is encountered before terrain farther along the descent");
251 Check(!state.ObstacleAlert() && approach.bus->GPWS.Alert == Bus::Gpws::TA_Terrain_Caution,
252 "equal-severity terrain retains guide priority in both map label and audio");
253 }
254 {
255 Fixture approach;
256 approach.Approach(9.319f,.6201f,.1f);
257 approach.bus->WPtargetC = -1; approach.Step();
258 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.terrain == Severity::None,
259 "Lancaster-like descent recognizes a received aligned runway without selecting it");
260 approach.bus->WPtargetC = 0; approach.Step();
261 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.terrain == Severity::None,
262 "selected runway limits look-down at 9.3 km instead of extrapolating through the field");
263 approach.bus->AFCS.CurrentLateralMode = Bus::Afcs::LateralMode_Off;
264 approach.bus->AFCS.CurrentVerticalMode = Bus::Afcs::VerticalMode_Off;
265 playerships[0].geardown = false; approach.Step();
266 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.Alert() == Severity::None,
267 "normal hand-flown approach with gear still up receives the same runway-aware ribbon");
268 approach.Structure(0,6,.1f); approach.Step();
269 Check(approach.bus->GPWS.terrain.obstacle == Severity::None,
270 "low buildings below the approach ribbon do not generate nuisance cautions");
271 approach.Structure(0,6,.4f); approach.Step();
272 Check(approach.bus->GPWS.terrain.obstacle == Severity::Warning && approach.bus->GPWS.terrain.terrain == Severity::None &&
273 approach.bus->GPWS.Alert == Bus::Gpws::TA_Obstacle_Warning && approach.bus->GPWS.terrain.ObstacleAlert(),
274 "tower penetrating a high-speed approach gets extended obstacle warning and matching map label");
275 approach.structures.buildzones.clear();
276 for (int u = 30; u <= 32; ++u) for (int v = 36; v <= 37; ++v)
277 gridarray[u][v].position = Surface((u-31)*.5f,(v-31)*.5f,.4f);
278 approach.Inside(); approach.Step();
279 Check(approach.bus->GPWS.terrain.terrain == Severity::Warning,
280 "intervening ridge still warns during a recognized runway approach");
281 }
282 {
283 Fixture approach;
284 for (float distance : {18.52f,9.319f,5.1f,4.9f,1.f,.1f,-.1f})
285 {
286 const bool final = distance <= 1;
287 approach.Approach(distance,(std::max)(distance,0.f)*.0525f+.01f,0,
288 final ? .05f : .166f,final ? -.001f : -.008715f);
289 approach.Step();
290 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.Alert() == Severity::None,
291 "normal approach stays quiet from ten nautical miles through flare and runway threshold");
292 }
293 approach.Structure(0,.1f,.04f); approach.Step();
294 Check(approach.bus->GPWS.terrain.obstacle == Severity::Warning,
295 "an obstruction on the runway is not exempted with the landing surface");
296 approach.Approach(-6.f,.01f,0,.05f,-.001f); approach.bus->waypoint[0].length = 8;
297 approach.Step();
298 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.obstacle == Severity::Warning,
299 "runway length beyond five km cannot truncate protection before the actual runway end");
300 }
301 {
302 Fixture approach;
303 const auto rejected = [&](const char* message) {
304 approach.Step(); Check(!approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.terrain != Severity::None,message);
305 };
306 approach.Approach(9.319f,.6201f,.1f); approach.bus->waypoint[0].type = 0;
307 rejected("an arbitrary navigation pin cannot suppress the descending terrain conflict");
308 approach.Approach(9.319f,.6201f,.1f); approach.bus->waypoint[0].heading = 180;
309 rejected("wrong runway direction is rejected even with LOC and GS modes set");
310 approach.Approach(9.319f,.6201f,.1f); approach.bus->waypoint[0].location = -Surface(2,9.319f,.1f);
311 rejected("off-course approach cannot gain a landing allowance");
312 approach.Approach(9.319f,.3f,.1f);
313 rejected("premature descent below the runway approach path restores terrain protection");
314 approach.Approach(9.319f,.6201f,.1f,.166f,-.03f);
315 rejected("excessive sink toward a selected runway cannot gain a landing allowance");
316 approach.Approach(9.319f,.6201f,.1f); approach.bus->WPtargetC = -1;
317 approach.gpws.FrameMove(2.1f); // Require sustained clearance of the preceding unsafe approach.
318 Check(approach.bus->GPWS.terrain.runwayApproach && approach.bus->GPWS.terrain.terrain == Severity::None,
319 "aligned received runway is inferred even without a selected waypoint");
320 approach.Approach(9.319f,.6201f,.1f,.166f,.01f); approach.Step();
321 Check(!approach.bus->GPWS.terrain.runwayApproach,
322 "go-around removes the expected-landing limit");
323 approach.Approach(9.319f,.6201f,.1f); approach.Step();
324 playerships[0].isSimulator = true; approach.Step();
325 Check(!approach.bus->GPWS.terrain.runwayApproach && !approach.bus->GPWS.terrain.enabled,
326 "simulator entry clears the runway-aware prediction state");
327 }
328 {
329 Fixture elevated;
330 for (int u = 0; u < 64; ++u) for (int v = 0; v < 64; ++v)
331 {
332 const float y = (v-31)*.5f;
333 gridarray[u][v].position = Surface((u-31)*.5f,y,
334 5.874f+.1f*(std::clamp)(y/9.319f,0.f,1.f));
335 }
336 elevated.Inside(); elevated.Approach(9.319f,6.4941f,5.974f);
337 elevated.bus->RadioAltitudeKm = .6201f;
338 elevated.bus->WPtargetC = -1; elevated.Step();
339 Check(elevated.bus->GPWS.terrain.runwayApproach && elevated.bus->GPWS.terrain.terrain == Severity::None,
340 "Lancaster runway is inferred without an explicitly selected waypoint");
341 elevated.bus->WPtargetC = 0; elevated.Step();
342 Check(elevated.bus->GPWS.terrain.runwayApproach && elevated.bus->GPWS.terrain.Alert() == Severity::None,
343 "runway-relative ribbon also handles Lancaster's 5974 m field elevation");
344 }
345 {
346 Fixture high;
347 high.terrain.dataReady = false; playerships[0].mslKm = 100; high.Step();
348 Check(!high.bus->GPWS.terrain.enabled,"100 km does not announce unavailable terrain data");
349 playerships[0].mslKm = 17; high.bus->VerticalSpeedKms = -.1f; high.Step();
350 Check(high.bus->GPWS.terrain.enabled,"rapid descent re-arms above 17 km before terrain is loaded");
351 high.bus->VerticalSpeedKms = 0; high.Step();
352 Check(!high.bus->GPWS.terrain.enabled,"level flight above the global obstacle bound suspends prediction");
353 playerships[0].mslKm = 11.4f; high.Step();
354 Check(high.bus->GPWS.terrain.enabled,"descending through the level-flight cutoff restores data annunciation");
355 playerships[0].mslKm = 11.6f; high.Step();
356 Check(high.bus->GPWS.terrain.enabled,"hysteresis prevents chatter around the suspension boundary");
357 playerships[0].mslKm = 11.7f; high.Step();
358 Check(!high.bus->GPWS.terrain.enabled,"climb beyond the hysteresis band suspends prediction");
359 }
360 {
361 Fixture approach;
362 // Move continuously, so the reactive closure-rate detector receives a
363 // real approach trajectory rather than a sequence of teleports.
364 float distance = 18.52f;
365 while (distance > .1f)
366 {
367 const float speed = distance > 6 ? .166f : distance > 2 ? .09f : .05f;
368 approach.Approach(distance,distance*.052408f+.01f,0,speed,-speed*.052408f);
369 approach.gpws.FrameMove(1);
370 Check(!*approach.bus->GPWS.AlertText(),"normal continuous 3-degree approach has no reactive, TCF/RFCF or predictive hazard warning");
371 distance -= speed;
372 }
373 }
374 {
375 Fixture high; playerships[0].mslKm = 20; playerships[0].position = -Surface(0,0,20); high.Step();
376 Check(high.bus->GPWS.terrain.enabled && !high.bus->GPWS.terrain.predictionEnabled &&
377 high.bus->GPWS.terrain.cells[31*63+31].valid,"known high-altitude Peaks data remains while predictive corridor is suspended");
378 high.bus->GPWS.positionValid = false; high.Step();
379 Check(!high.bus->GPWS.terrain.enabled && (high.bus->GPWS.faults&4),"position invalidity inhibits TAD with an explicit input fault");
380 }
381 // Row rejection must preserve classification across coarse/fine boundaries,
382 // grid edges and rotated tracks. Adjacent pavement and towers share a cell.
383 for (float degrees : {0.f,45.f,90.f,135.f,180.f,270.f})
384 {
385 Fixture bounds;
386 const float angle = RiseMath::ToRadian(degrees);
387 playerships[0].velocity = playerships[0].barycentric + RiseMath::Vector3(.1f*std::sin(angle),.1f*std::cos(angle),0);
388 int towers = 0;
389 for (int u : {0,15,16,30,46,47,61}) for (int v : {0,15,16,30,46,47,61})
390 {
391 const float x = (u-31)*.5f+.25f, y = (v-31)*.5f+.25f;
392 bounds.Structure(x,y,.001f,.02f);
393 bounds.Structure(x,y,.3f,.02f);
394 ++towers;
395 }
396 bounds.Step();
397 Check(bounds.bus->GPWS.terrain.obstacles.size() == size_t(towers),"rotated track and coarse/fine/edge rows retain all towers and reject pavement");
398 for (const auto& obstacle : bounds.bus->GPWS.terrain.obstacles)
399 Check(obstacle.topKm == .3f,"row rejection never leaves pavement classified as an obstacle");
400 }
401 std::cout << "PASS: " << checks << " total production scene checks\n";
402}
#define MAX_SCAN
@ UserTownship
@ NotZoned
@ REF_APNMODE
Definition ServerTypes.h:42
@ REF_ONGROUND
Definition ServerTypes.h:43
struct Bus::Gpws GPWS
Bus(Logger *prmLogger)
Definition Bus.cpp:55
void UpdatePredictiveWindshear(float seconds)
void FrameMove(float fElapsedTime) override
Definition GPWS.cpp:52
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
Logger()
Definition Logger.cpp:392
~Logger()
Definition Logger.cpp:448
Bus * bus
Definition Module.h:21
RiseMath::Vector3 QuadraticVectorInterpolation(RiseMath::Vector3 *vel0, RiseMath::Vector3 *vel1, RiseMath::Vector3 *vel2, float t) const
std::unique_ptr< grid > ptrGrid
Definition Viewscreen.h:426
std::unique_ptr< buildings > ptrBuildings
Definition Viewscreen.h:428
RiseMath::Vector3 forwardVector
Definition Viewscreen.h:363
Logger * logger
Definition Viewscreen.h:440
Definition grid.h:14
bool geometryReady
Definition grid.h:37
uint64_t ElevationRevision() const
Definition grid.h:54
bool dataReady
Definition grid.h:36
void CalculateInsideArray(short t, short s) const
Definition grid.cpp:1230
Viewscreen * viewscreen
Definition grid.h:15
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
RiseMath::Vector3 insidearray[63][63][3]
Definition globals.cpp:102
Scockpit ourcockpit
Definition globals.cpp:114
bool g_bAboveClouds
Definition globals.cpp:16
LOCALGRID2 gridarray[64][64]
Definition globals.cpp:100
#define radiusC
Definition globals.h:87
bool Inside(Vec p, const Triangle &t)
Definition RigidProp.h:147
auto ToRadian(T value)
Definition ClientMath.h:13
uint32_t Color(float terrainKm, float altitudeKm, float verticalKms, bool gearDown, Severity severity, bool known=true, float displayRunwayKm=-100, bool onGround=false)
type
Definition erin.py:143
@ LateralMode_Off
Definition Bus.h:112
@ Localizer
Definition Bus.h:116
@ Glideslope
Definition Bus.h:104
@ VerticalMode_Off
Definition Bus.h:97
@ TA_Terrain_Caution
Definition Bus.h:205
@ TA_Obstacle_Warning
Definition Bus.h:202
GpwsPredictiveWindshear::State predictiveWindshear
Definition Bus.h:265
void Include(const Vector &p)
PlotType type
Definition globals.h:276
short buildzoneOrdinal
Definition globals.h:286
RiseMath::Vector3 position
Definition globals.h:273
VECTOR2SHORT tcp
Definition globals.h:290
float maxGrossLbs
Definition globals.h:634
float power
Definition globals.h:599
std::vector< FlapSetting > flapSettings
Definition globals.h:661
float emptyWeightLbs
Definition globals.h:633
bool wheeled
Definition globals.h:596
unsigned char type
Definition globals.h:403
float boundsphere
Definition globals.h:410
RiseMath::Vector3 barycentric
Definition globals.h:500
RiseMath::Vector3 position
Definition globals.h:511
unsigned short vehicleId
Definition globals.h:537
RiseMath::Vector3 velocity
Definition globals.h:500