1 // HUD_ladder.cxx -- HUD Ladder Instrument
3 // Written by Michele America, started September 1997.
5 // Copyright (C) 1997 Michele F. America [micheleamerica#geocities:com]
6 // Copyright (C) 2006 Melchior FRANZ [mfranz#aon:at]
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 #include <simgear/math/vector.hxx>
27 #include <Main/viewer.hxx>
32 float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; }
33 float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); }
34 float get__Vx() { return fgGetFloat("/velocities/uBody-fps"); }
35 float get__Vy() { return fgGetFloat("/velocities/vBody-fps"); }
36 float get__Vz() { return fgGetFloat("/velocities/wBody-fps"); }
37 float get__Ax() { return fgGetFloat("/acclerations/pilot/x-accel-fps_sec"); }
38 float get__Ay() { return fgGetFloat("/acclerations/pilot/y-accel-fps_sec"); }
39 float get__Az() { return fgGetFloat("/acclerations/pilot/z-accel-fps_sec"); }
40 float get__alpha() { return fgGetFloat("/orientation/alpha-deg"); }
41 float get__beta() { return fgGetFloat("/orientation/side-slip-deg"); }
45 HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
47 _pitch(n->getNode("pitch-input", false)),
48 _roll(n->getNode("roll-input", false)),
49 _width_units(int(n->getFloatValue("display-span"))),
50 _div_units(int(fabs(n->getFloatValue("divisions")))),
51 _scr_hole(n->getIntValue("screen-hole")),
52 _compression(n->getFloatValue("compression-factor")),
53 _dynamic_origin(n->getBoolValue("enable-dynamic-origin")),
54 _clip_plane(n->getBoolValue("enable-clip-plane")),
55 _frl(n->getBoolValue("enable-fuselage-ref-line")),
56 _target_spot(n->getBoolValue("enable-target-spot")),
57 _target_markers(n->getBoolValue("enable-target-markers")),
58 _velocity_vector(n->getBoolValue("enable-velocity-vector")),
59 _drift_marker(n->getBoolValue("enable-drift-marker")),
60 _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
61 _energy_marker(n->getBoolValue("enable-energy-marker")),
62 _climb_dive_marker(n->getBoolValue("enable-climb-dive-marker")),
63 _glide_slope_marker(n->getBoolValue("enable-glide-slope-marker")),
64 _glide_slope(n->getFloatValue("glide-slope", -4.0)),
65 _energy_worm(n->getBoolValue("enable-energy-marker")),
66 _waypoint_marker(n->getBoolValue("enable-waypoint-marker")),
67 _zenith(n->getBoolValue("enable-zenith")),
68 _nadir(n->getBoolValue("enable-nadir")),
69 _hat(n->getBoolValue("enable-hat"))
71 const char *t = n->getStringValue("type");
72 _type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
77 _vmax = _width_units / 2;
82 void HUD::Ladder::draw(void)
84 if (!_pitch.isValid() || !_roll.isValid())
87 float roll_value = _roll.getFloatValue() * SGD_DEGREES_TO_RADIANS;
88 float pitch_value = _pitch.getFloatValue();
91 //**************************************************************
93 glTranslatef(_center_x, _center_y, 0);
95 // OBJECT STATIC RETICLE
96 // TYPE FRL (FUSELAGE REFERENCE LINE)
98 // Draw the FRL spot and line
100 #define FRL_DIAMOND_SIZE 2.0
101 glBegin(GL_LINE_LOOP);
102 glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
103 glVertex2f(0.0, FRL_DIAMOND_SIZE);
104 glVertex2f(FRL_DIAMOND_SIZE, 0.0);
105 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
108 glBegin(GL_LINE_STRIP);
109 glVertex2f(0, FRL_DIAMOND_SIZE);
112 #undef FRL_DIAMOND_SIZE
114 // TYPE WATERLINE_MARK (W shaped _ _ ) // TODO (-> HUD_misc.cxx)
117 //****************************************************************
119 // Draw the target spot.
121 #define CENTER_DIAMOND_SIZE 6.0
122 glBegin(GL_LINE_LOOP);
123 glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
124 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
125 glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
126 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
128 #undef CENTER_DIAMOND_SIZE
131 //****************************************************************
132 //velocity vector reticle - computations
133 float xvvr, /* yvvr, */ Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
134 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
135 float up_vel, ground_vel, actslope = 0.0, psi = 0.0;
136 float vel_x = 0.0, vel_y = 0.0, drift;
138 if (_velocity_vector) {
140 alpha = get__alpha();
148 psi = get__heading();
153 total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
154 ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
157 if (ground_vel < 2.0) {
158 if (fabs(up_vel) < 2.0)
161 actslope = (up_vel / fabs(up_vel)) * 90.0;
164 actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
167 xvvr = (-drift * (_compression / globals->get_current_view()->get_aspect_ratio()));
168 // drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
169 // yvvr = (-alpha * _compression);
170 // vel_y = (-alpha * cos(roll_value) + drift * sin(roll_value)) * _compression;
171 // vel_x = (alpha * sin(roll_value) + drift * cos(roll_value))
172 // * (_compression / globals->get_current_view()->get_aspect_ratio());
173 vel_y = -alpha * _compression;
174 vel_x = -drift * (_compression / globals->get_current_view()->get_aspect_ratio());
175 // printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
177 //****************************************************************
178 // OBJECT MOVING RETICLE
179 // TYPE - DRIFT MARKER
183 glBegin(GL_LINE_STRIP);
184 glVertex2f((xvvr * 25 / 120) - 6, -4);
185 glVertex2f(xvvr * 25 / 120, 8);
186 glVertex2f((xvvr * 25 / 120) + 6, -4);
190 //****************************************************************
191 // Clipping coordinates for ladder to be input from xml file
192 // Clip hud ladder. FIXME, these should be configurable, but they
193 // have always been hardcoded here.
195 GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
196 GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
197 GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
199 glClipPlane(GL_CLIP_PLANE0, eqn_top);
200 glEnable(GL_CLIP_PLANE0);
201 glClipPlane(GL_CLIP_PLANE1, eqn_left);
202 glEnable(GL_CLIP_PLANE1);
203 glClipPlane(GL_CLIP_PLANE2, eqn_right);
204 glEnable(GL_CLIP_PLANE2);
207 //****************************************************************
208 // OBJECT MOVING RETICLE
209 // TYPE VELOCITY VECTOR
212 draw_circle(vel_x, vel_y, 6);
214 //velocity vector reticle orientation lines
215 glBegin(GL_LINE_STRIP);
216 glVertex2f(vel_x - 12, vel_y);
217 glVertex2f(vel_x - 6, vel_y);
219 glBegin(GL_LINE_STRIP);
220 glVertex2f(vel_x + 12, vel_y);
221 glVertex2f(vel_x + 6, vel_y);
223 glBegin(GL_LINE_STRIP);
224 glVertex2f(vel_x, vel_y + 12);
225 glVertex2f(vel_x, vel_y + 6);
229 int lgear = get__iaux3();
230 int ihook = get__iaux6();
232 // OBJECT MOVING RETICLE
234 // ATTRIB - ON CONDITION
236 // undercarriage status
237 glBegin(GL_LINE_STRIP);
238 glVertex2f(vel_x + 8, vel_y);
239 glVertex2f(vel_x + 8, vel_y - 4);
242 // OBJECT MOVING RETICLE
244 // ATTRIB - ON CONDITION
245 glBegin(GL_LINE_STRIP);
246 glVertex2f(vel_x - 8, vel_y);
247 glVertex2f(vel_x - 8, vel_y - 4);
250 // OBJECT MOVING RETICLE
252 // ATTRIB - ON CONDITION
253 glBegin(GL_LINE_STRIP);
254 glVertex2f(vel_x, vel_y - 6);
255 glVertex2f(vel_x, vel_y - 10);
259 // OBJECT MOVING RETICLE
261 // ATTRIB - ON CONDITION
263 // arrestor hook status
264 glBegin(GL_LINE_STRIP);
265 glVertex2f(vel_x - 4, vel_y - 8);
266 glVertex2f(vel_x, vel_y - 10);
267 glVertex2f(vel_x + 4, vel_y - 8);
271 } // if _velocity_vector
273 // draw hud markers on top of each AI/MP target
274 if (_target_markers) {
275 SGPropertyNode *models = globals->get_props()->getNode("/ai/models", true);
276 for (int i = 0; i < models->nChildren(); i++) {
277 SGPropertyNode *chld = models->getChild(i);
279 name = chld->getName();
280 if (name == "aircraft" || name == "multiplayer") {
281 string callsign = chld->getStringValue("callsign");
282 if (callsign != "") {
283 float h_deg = chld->getFloatValue("radar/h-offset");
284 float v_deg = chld->getFloatValue("radar/v-offset");
285 float pos_x = (h_deg * cos(roll_value) -
286 v_deg * sin(roll_value)) * _compression;
287 float pos_y = (v_deg * cos(roll_value) +
288 h_deg * sin(roll_value)) * _compression;
289 draw_circle(pos_x, pos_y, 8);
295 //***************************************************************
296 // OBJECT MOVING RETICLE
297 // TYPE - SQUARE_BRACKET
298 // ATTRIB - ON CONDITION
301 alpha = get__alpha();
303 if (_alpha_bracket && ihook == 1) {
304 glBegin(GL_LINE_STRIP);
305 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
306 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
307 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
308 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
311 glBegin(GL_LINE_STRIP);
312 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
313 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
314 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
315 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
319 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
320 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
322 //****************************************************************
323 // OBJECT MOVING RETICLE
324 // TYPE ENERGY_MARKERS
326 //energy markers - compute potential slope
327 float pla = get__throttleval();
330 if (_energy_marker) {
331 if (total_vel < 5.0) {
335 t1 = up_vel / total_vel;
336 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
338 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
339 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
340 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
343 glBegin(GL_LINE_STRIP);
344 glVertex2f(vel_x - 20, pot_slope - 5);
345 glVertex2f(vel_x - 15, pot_slope);
346 glVertex2f(vel_x - 20, pot_slope + 5);
349 glBegin(GL_LINE_STRIP);
350 glVertex2f(vel_x + 20, pot_slope - 5);
351 glVertex2f(vel_x + 15, pot_slope);
352 glVertex2f(vel_x + 20, pot_slope + 5);
355 if (pla > (105.0 / 131.0)) {
356 glBegin(GL_LINE_STRIP);
357 glVertex2f(vel_x - 24, pot_slope - 5);
358 glVertex2f(vel_x - 19, pot_slope);
359 glVertex2f(vel_x - 24, pot_slope + 5);
362 glBegin(GL_LINE_STRIP);
363 glVertex2f(vel_x + 24, pot_slope - 5);
364 glVertex2f(vel_x + 19, pot_slope);
365 glVertex2f(vel_x + 24, pot_slope + 5);
370 //**********************************************************
372 // OBJECT STATIC RETICLE
374 // ATTRIB - ON CONDITION
376 int ilcanclaw = get__iaux2();
378 if (_energy_worm && ilcanclaw == 1) {
379 glBegin(GL_LINE_STRIP);
380 glVertex2f(-15, -134);
381 glVertex2f(15, -134);
384 // OBJECT MOVING RETICLE
386 // ATTRIB - ON CONDITION
387 glBegin(GL_LINE_STRIP);
388 glVertex2f(-6, -134);
389 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
390 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
394 // OBJECT MOVING RETICLE
396 // ATTRIB - ON CONDITION
397 glBegin(GL_LINE_LOOP);
398 glVertex2f(-6, actslope * 4.0 - 134);
399 glVertex2f(0, actslope * 4.0 -134 + 3);
400 glVertex2f(6, actslope * 4.0 - 134);
401 glVertex2f(0, actslope * 4.0 -134 -3);
406 //*************************************************************
407 // OBJECT MOVING RETICLE
410 // Draw the locked velocity vector.
411 if (_climb_dive_marker) {
412 glBegin(GL_LINE_LOOP);
413 glVertex2f(-3.0, 0.0 + vel_y);
414 glVertex2f(0.0, 6.0 + vel_y);
415 glVertex2f(3.0, 0.0 + vel_y);
416 glVertex2f(0.0, -6.0 + vel_y);
420 //****************************************************************
422 if (_dynamic_origin) {
423 // ladder moves with alpha/beta offset projected onto horizon
424 // line (so that the horizon line always aligns with the
426 _vmin = pitch_value - _width_units * 0.5f;
427 _vmax = pitch_value + _width_units * 0.5f;
429 // the hud ladder center point should move relative to alpha/beta
430 // however the horizon line should always stay on the horizon. We
431 // project the alpha/beta offset onto the horizon line to get the
433 sgdVec3 p1; // result
434 sgdVec3 p; sgdSetVec3(p, vel_x, vel_y, 0.0);
435 sgdVec3 p0; sgdSetVec3(p0, 0.0, 0.0, 0.0);
436 sgdVec3 d; sgdSetVec3(d, cos(roll_value), sin(roll_value), 0.0);
437 sgdClosestPointToLine(p1, p, p0, d);
438 glTranslatef(p1[0], p1[1], 0);
441 // ladder position is fixed relative to the center of the screen.
442 _vmin = pitch_value - _width_units * 0.5f;
443 _vmax = pitch_value + _width_units * 0.5f;
446 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
447 // FRL marker not rotated - this line shifted below
448 float half_span = _w / 2.0;
449 float y = 0, y_end = 0;
454 const int BUFSIZE = 8;
456 const float zero_offset = 50.0f; // horizon line is wider by this much
458 _locTextList.setFont(_hud->_font_renderer);
459 _locTextList.erase();
460 _locLineList.erase();
461 _locStippleLineList.erase();
463 int last = int(_vmax) + 1;
469 for (; i < last; i++) {
470 y = (i - pitch_value) * _compression + .5f;
472 if (!(i % _div_units)) { // At integral multiple of div
473 snprintf(buf, BUFSIZE, "%d", i);
477 // Make zero point wider on left
478 x_ini -= zero_offset;
479 x_end += zero_offset;
481 draw_line(x_ini, y, x_end, y);
484 // Zero or above draw solid lines
485 draw_line(x_ini, y, x_end, y);
487 if (i == 90 && _zenith)
490 // Below zero draw dashed lines.
491 draw_stipple_line(x_ini, y, x_end, y);
493 if (i == -90 && _nadir)
497 draw_text(x_ini - 4, y, buf, HUDText::VCENTER|HUDText::LEFT);
498 draw_text(x_end + 4, y, buf, HUDText::VCENTER|HUDText::RIGHT);
502 } else { // if (_scr_hole)
503 // Draw ladder with space in the middle of the lines
504 float hole = _scr_hole / 2.0f;
506 x_end = -half_span + hole;
507 x_ini2 = half_span - hole;
509 for (; i < last; i++) {
510 if (_type == PITCH) {
511 y = float(i - pitch_value) * _compression + .5;
512 } else { // _type == CLIMB_DIVE
513 y = float(i - actslope) * _compression + .5;
516 if (!(i % _div_units)) { // At integral multiple of div
517 snprintf(buf, BUFSIZE, "%d", i);
519 // Start by calculating the points and drawing the
526 // Make zero point wider on left
527 x_ini -= zero_offset;
528 x_end2 += zero_offset;
530 draw_line(x_ini, y, x_end, y);
531 draw_line(x_ini2, y, x_end2, y);
533 draw_text(x_ini - 2.0, y, buf, HUDText::VCENTER|HUDText::RIGHT);
534 draw_text(x_end2 + 2.0, y, buf, HUDText::VCENTER|HUDText::LEFT);
537 //draw climb bar vertical lines
538 draw_line(x_ini, y - 5.0, x_ini, y);
539 draw_line(x_end2, y - 5.0, x_end2, y);
541 // draw pitch / climb bar
542 draw_line(x_ini, y, x_end, y);
543 draw_line(x_ini2, y, x_end2, y);
545 draw_text(x_ini + 0.5, y - 0.5, buf, HUDText::TOP|HUDText::LEFT);
546 draw_text(x_end2 - 0.5, y - 0.5, buf, HUDText::TOP|HUDText::RIGHT);
548 if (i == 90 && _zenith)
552 float alpha = i * SG_DEGREES_TO_RADIANS / 2.0;
553 y_end = y + (x_end - x_ini) * sin(alpha);
555 float w = (x_end - x_ini) * cos(alpha);
559 // draw dive bar vertical lines
560 draw_line(x_end, y + 5.0, x_end, y);
561 draw_line(x_ini2, y + 5.0, x_ini2, y);
563 // draw pitch / dive bars
564 draw_stipple_line(x_ini, y_end, x_end, y);
565 draw_stipple_line(x_ini2, y, x_end2, y_end);
567 float yoffs = 1.0 + (y - y_end) / 4.0; // too hackish?
568 draw_text(x_ini + 2.0, y_end + yoffs, buf, HUDText::BOTTOM|HUDText::HCENTER);
569 draw_text(x_end2 - 2.0, y_end + yoffs, buf, HUDText::BOTTOM|HUDText::HCENTER);
571 if (i == -90 && _nadir)
577 // OBJECT LADDER MARK
579 // ATTRIB - ON CONDITION
580 // draw appraoch glide slope marker
582 if (_glide_slope_marker && ihook) {
583 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
584 -half_span + hole, (_glide_slope - actslope) * _compression);
585 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
586 half_span - hole, (_glide_slope - actslope) * _compression);
596 glEnable(GL_LINE_STIPPLE);
597 glLineStipple(1, 0x00FF);
598 _locStippleLineList.draw();
599 glDisable(GL_LINE_STIPPLE);
601 glDisable(GL_CLIP_PLANE0);
602 glDisable(GL_CLIP_PLANE1);
603 glDisable(GL_CLIP_PLANE2);
605 //*************************************************************
607 //*************************************************************
609 if (_waypoint_marker) {
610 //waypoint marker computation
611 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
613 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
614 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
615 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
616 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
618 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
619 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
620 delx= towp_lat - fromwp_lat;
621 dely = towp_lon - fromwp_lon;
622 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
625 theta = asin(dely / hyp);
629 brg = theta * SGD_RADIANS_TO_DEGREES;
635 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
636 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
638 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
639 // end waypoint marker computation
641 //*********************************************************
642 // OBJECT MOVING RETICLE
645 if (fabs(brg - psi) > 10.0) {
647 glTranslatef(_center_x, _center_y, 0);
648 glTranslatef(vel_x, vel_y, 0);
649 glRotatef(brg - psi, 0.0, 0.0, -1.0);
650 glBegin(GL_LINE_LOOP);
651 glVertex2f(-2.5, 20.0);
652 glVertex2f(-2.5, 30.0);
653 glVertex2f(-5.0, 30.0);
654 glVertex2f(0.0, 35.0);
655 glVertex2f(5.0, 30.0);
656 glVertex2f(2.5, 30.0);
657 glVertex2f(2.5, 20.0);
662 // waypoint marker on heading scale
663 if (fabs(brg - psi) < 12.0) {
665 glBegin(GL_LINE_LOOP);
666 GLfloat x = (brg - psi) * 60 / 25;
667 glVertex2f(x + 320, 240.0);
668 glVertex2f(x + 326, 240.0 - 4);
669 glVertex2f(x + 323, 240.0 - 4);
670 glVertex2f(x + 323, 240.0 - 8);
671 glVertex2f(x + 317, 240.0 - 8);
672 glVertex2f(x + 317, 240.0 - 4);
673 glVertex2f(x + 314, 240.0 - 4);
676 } else { // if (_hat)
677 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
680 glEnable(GL_POINT_SMOOTH);
683 for (int count = 0; count <= 200; count++) {
684 float temp = count * SG_PI * 3 / (200.0 * 2.0);
685 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
686 x1 = x + r * cos(temp1);
687 y1 = y + r * sin(temp1);
692 glDisable(GL_POINT_SMOOTH);
696 } // if _waypoint_marker
701 /******************************************************************/
702 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
704 void HUD::Ladder::draw_zenith(float x, float y)
706 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
707 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
709 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
710 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
712 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
713 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
715 draw_line(x - 3.9, y + 3.9, x - 3.0, y + 1.3);
716 draw_line(x - 3.9, y + 3.9, x - 1.3, y + 3.0);
718 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
719 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
721 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
722 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
724 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
725 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
727 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
728 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
732 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
734 void HUD::Ladder::draw_nadir(float x, float y)
738 draw_circle(x, y, R);
739 draw_line(x, y + R, x, y + 22.5); // line above the circle
740 draw_line(x - R, y, x + R, y); // line at middle of circle
742 float theta = asin(2.5 / R);
743 float theta1 = asin(5.0 / R);
744 float x1, y1, x2, y2;
746 x1 = x + R * cos(theta);
748 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
750 draw_line(x1, y1, x2, y2);
752 x1 = x + R * cos(theta1);
754 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
756 draw_line(x1, y1, x2, y2);
758 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
760 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
762 draw_line(x1, y1, x2, y2);
764 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
766 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
768 draw_line(x1, y1, x2, y2);