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 <Main/viewer.hxx>
31 float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; }
32 float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); }
33 float get__Vx() { return fgGetFloat("/velocities/uBody-fps"); }
34 float get__Vy() { return fgGetFloat("/velocities/vBody-fps"); }
35 float get__Vz() { return fgGetFloat("/velocities/wBody-fps"); }
36 float get__Ax() { return fgGetFloat("/acclerations/pilot/x-accel-fps_sec"); }
37 float get__Ay() { return fgGetFloat("/acclerations/pilot/y-accel-fps_sec"); }
38 float get__Az() { return fgGetFloat("/acclerations/pilot/z-accel-fps_sec"); }
39 float get__alpha() { return fgGetFloat("/orientation/alpha-deg"); }
40 float get__beta() { return fgGetFloat("/orientation/side-slip-deg"); }
44 HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
46 _pitch(n->getNode("pitch-input", false)),
47 _roll(n->getNode("roll-input", false)),
48 _width_units(int(n->getFloatValue("display-span"))),
49 _div_units(int(fabs(n->getFloatValue("divisions")))),
50 _scr_hole(n->getIntValue("screen-hole")),
51 _compression(n->getFloatValue("compression-factor")),
52 _frl(n->getBoolValue("enable-fuselage-ref-line")),
53 _target_spot(n->getBoolValue("enable-target-spot")),
54 _target_markers(n->getBoolValue("enable-target-markers")),
55 _velocity_vector(n->getBoolValue("enable-velocity-vector")),
56 _drift_marker(n->getBoolValue("enable-drift-marker")),
57 _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
58 _energy_marker(n->getBoolValue("enable-energy-marker")),
59 _climb_dive_marker(n->getBoolValue("enable-climb-dive-marker")),
60 _glide_slope_marker(n->getBoolValue("enable-glide-slope-marker")),
61 _glide_slope(n->getFloatValue("glide-slope", -4.0)),
62 _energy_worm(n->getBoolValue("enable-energy-marker")),
63 _waypoint_marker(n->getBoolValue("enable-waypoint-marker")),
64 _zenith(n->getBoolValue("enable-zenith")),
65 _nadir(n->getBoolValue("enable-nadir")),
66 _hat(n->getBoolValue("enable-hat"))
68 const char *t = n->getStringValue("type");
69 _type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
74 _vmax = _width_units / 2;
79 void HUD::Ladder::draw(void)
81 if (!_pitch.isValid() || !_roll.isValid())
84 float roll_value = _roll.getFloatValue() * SGD_DEGREES_TO_RADIANS;
85 float pitch_value = _pitch.getFloatValue();
89 bool climb_dive_ladder;
92 if (_type == CLIMB_DIVE) {
94 climb_dive_ladder = true;
97 } else { // _type == PITCH
99 climb_dive_ladder = false;
103 //**************************************************************
105 glTranslatef(_center_x, _center_y, 0);
107 // OBJECT STATIC RETICLE
108 // TYPE FRL (FUSELAGE REFERENCE LINE)
110 // Draw the FRL spot and line
112 #define FRL_DIAMOND_SIZE 2.0
113 glBegin(GL_LINE_LOOP);
114 glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
115 glVertex2f(0.0, FRL_DIAMOND_SIZE);
116 glVertex2f(FRL_DIAMOND_SIZE, 0.0);
117 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
120 glBegin(GL_LINE_STRIP);
121 glVertex2f(0, FRL_DIAMOND_SIZE);
124 #undef FRL_DIAMOND_SIZE
126 // TYPE WATERLINE_MARK (W shaped _ _ ) // TODO (-> HUD_misc.cxx)
129 //****************************************************************
131 // Draw the target spot.
133 #define CENTER_DIAMOND_SIZE 6.0
134 glBegin(GL_LINE_LOOP);
135 glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
136 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
137 glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
138 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
140 #undef CENTER_DIAMOND_SIZE
143 //****************************************************************
144 //velocity vector reticle - computations
145 float xvvr, /* yvvr, */ Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
146 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
147 float up_vel, ground_vel, actslope = 0.0, psi = 0.0;
148 float vel_x = 0.0, vel_y = 0.0, drift;
150 if (_velocity_vector) {
152 alpha = get__alpha();
160 psi = get__heading();
165 total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
166 ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
169 if (ground_vel < 2.0) {
170 if (fabs(up_vel) < 2.0)
173 actslope = (up_vel / fabs(up_vel)) * 90.0;
176 actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
179 xvvr = (-drift * (_compression / globals->get_current_view()->get_aspect_ratio()));
180 // drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
181 // yvvr = (-alpha * _compression);
182 // vel_y = (-alpha * cos(roll_value) + drift * sin(roll_value)) * _compression;
183 // vel_x = (alpha * sin(roll_value) + drift * cos(roll_value))
184 // * (_compression / globals->get_current_view()->get_aspect_ratio());
185 vel_y = -alpha * _compression;
186 vel_x = -drift * (_compression / globals->get_current_view()->get_aspect_ratio());
187 // printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
189 //****************************************************************
190 // OBJECT MOVING RETICLE
191 // TYPE - DRIFT MARKER
195 glBegin(GL_LINE_STRIP);
196 glVertex2f((xvvr * 25 / 120) - 6, -4);
197 glVertex2f(xvvr * 25 / 120, 8);
198 glVertex2f((xvvr * 25 / 120) + 6, -4);
202 //****************************************************************
203 // Clipping coordinates for ladder to be input from xml file
206 GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
207 GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
208 GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
210 glClipPlane(GL_CLIP_PLANE0, eqn_top);
211 glEnable(GL_CLIP_PLANE0);
212 glClipPlane(GL_CLIP_PLANE1, eqn_left);
213 glEnable(GL_CLIP_PLANE1);
214 glClipPlane(GL_CLIP_PLANE2, eqn_right);
215 glEnable(GL_CLIP_PLANE2);
218 //****************************************************************
219 // OBJECT MOVING RETICLE
220 // TYPE VELOCITY VECTOR
223 draw_circle(vel_x, vel_y, 6);
225 //velocity vector reticle orientation lines
226 glBegin(GL_LINE_STRIP);
227 glVertex2f(vel_x - 12, vel_y);
228 glVertex2f(vel_x - 6, vel_y);
230 glBegin(GL_LINE_STRIP);
231 glVertex2f(vel_x + 12, vel_y);
232 glVertex2f(vel_x + 6, vel_y);
234 glBegin(GL_LINE_STRIP);
235 glVertex2f(vel_x, vel_y + 12);
236 glVertex2f(vel_x, vel_y + 6);
240 int lgear = get__iaux3();
241 int ihook = get__iaux6();
243 // OBJECT MOVING RETICLE
245 // ATTRIB - ON CONDITION
247 // undercarriage status
248 glBegin(GL_LINE_STRIP);
249 glVertex2f(vel_x + 8, vel_y);
250 glVertex2f(vel_x + 8, vel_y - 4);
253 // OBJECT MOVING RETICLE
255 // ATTRIB - ON CONDITION
256 glBegin(GL_LINE_STRIP);
257 glVertex2f(vel_x - 8, vel_y);
258 glVertex2f(vel_x - 8, vel_y - 4);
261 // OBJECT MOVING RETICLE
263 // ATTRIB - ON CONDITION
264 glBegin(GL_LINE_STRIP);
265 glVertex2f(vel_x, vel_y - 6);
266 glVertex2f(vel_x, vel_y - 10);
270 // OBJECT MOVING RETICLE
272 // ATTRIB - ON CONDITION
274 // arrestor hook status
275 glBegin(GL_LINE_STRIP);
276 glVertex2f(vel_x - 4, vel_y - 8);
277 glVertex2f(vel_x, vel_y - 10);
278 glVertex2f(vel_x + 4, vel_y - 8);
282 } // if _velocity_vector
284 // draw hud markers on top of each AI/MP target
285 if (_target_markers) {
286 SGPropertyNode *models = globals->get_props()->getNode("/ai/models", true);
287 for (int i = 0; i < models->nChildren(); i++) {
288 SGPropertyNode *chld = models->getChild(i);
290 name = chld->getName();
291 if (name == "aircraft" || name == "multiplayer") {
292 string callsign = chld->getStringValue("callsign");
293 if (callsign != "") {
294 float h_deg = chld->getFloatValue("radar/h-offset");
295 float v_deg = chld->getFloatValue("radar/v-offset");
296 float pos_x = (h_deg * cos(roll_value) -
297 v_deg * sin(roll_value)) * _compression;
298 float pos_y = (v_deg * cos(roll_value) +
299 h_deg * sin(roll_value)) * _compression;
300 draw_circle(pos_x, pos_y, 8);
306 //***************************************************************
307 // OBJECT MOVING RETICLE
308 // TYPE - SQUARE_BRACKET
309 // ATTRIB - ON CONDITION
312 alpha = get__alpha();
314 if (_alpha_bracket && ihook == 1) {
315 glBegin(GL_LINE_STRIP);
316 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
317 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
318 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
319 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
322 glBegin(GL_LINE_STRIP);
323 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
324 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
325 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
326 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
330 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
331 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
333 //****************************************************************
334 // OBJECT MOVING RETICLE
335 // TYPE ENERGY_MARKERS
337 //energy markers - compute potential slope
338 float pla = get__throttleval();
341 if (_energy_marker) {
342 if (total_vel < 5.0) {
346 t1 = up_vel / total_vel;
347 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
349 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
350 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
351 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
354 glBegin(GL_LINE_STRIP);
355 glVertex2f(vel_x - 20, pot_slope - 5);
356 glVertex2f(vel_x - 15, pot_slope);
357 glVertex2f(vel_x - 20, pot_slope + 5);
360 glBegin(GL_LINE_STRIP);
361 glVertex2f(vel_x + 20, pot_slope - 5);
362 glVertex2f(vel_x + 15, pot_slope);
363 glVertex2f(vel_x + 20, pot_slope + 5);
366 if (pla > (105.0 / 131.0)) {
367 glBegin(GL_LINE_STRIP);
368 glVertex2f(vel_x - 24, pot_slope - 5);
369 glVertex2f(vel_x - 19, pot_slope);
370 glVertex2f(vel_x - 24, pot_slope + 5);
373 glBegin(GL_LINE_STRIP);
374 glVertex2f(vel_x + 24, pot_slope - 5);
375 glVertex2f(vel_x + 19, pot_slope);
376 glVertex2f(vel_x + 24, pot_slope + 5);
381 //**********************************************************
383 // OBJECT STATIC RETICLE
385 // ATTRIB - ON CONDITION
387 int ilcanclaw = get__iaux2();
389 if (_energy_worm && ilcanclaw == 1) {
390 glBegin(GL_LINE_STRIP);
391 glVertex2f(-15, -134);
392 glVertex2f(15, -134);
395 // OBJECT MOVING RETICLE
397 // ATTRIB - ON CONDITION
398 glBegin(GL_LINE_STRIP);
399 glVertex2f(-6, -134);
400 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
401 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
405 // OBJECT MOVING RETICLE
407 // ATTRIB - ON CONDITION
408 glBegin(GL_LINE_LOOP);
409 glVertex2f(-6, actslope * 4.0 - 134);
410 glVertex2f(0, actslope * 4.0 -134 + 3);
411 glVertex2f(6, actslope * 4.0 - 134);
412 glVertex2f(0, actslope * 4.0 -134 -3);
417 //*************************************************************
418 // OBJECT MOVING RETICLE
421 // Draw the locked velocity vector.
422 if (_climb_dive_marker) {
423 glBegin(GL_LINE_LOOP);
424 glVertex2f(-3.0, 0.0 + vel_y);
425 glVertex2f(0.0, 6.0 + vel_y);
426 glVertex2f(3.0, 0.0 + vel_y);
427 glVertex2f(0.0, -6.0 + vel_y);
431 //****************************************************************
433 if (climb_dive_ladder) { // CONFORMAL_HUD
434 _vmin = pitch_value - _width_units;
435 _vmax = pitch_value + _width_units;
436 glTranslatef(vel_x, vel_y, 0);
438 } else { // pitch_ladder - Default Hud
439 _vmin = pitch_value - _width_units * 0.5f;
440 _vmax = pitch_value + _width_units * 0.5f;
443 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
444 // FRL marker not rotated - this line shifted below
445 float half_span = _w / 2.0;
451 const int BUFSIZE = 8;
459 float text_offset = 4.0f;
460 float zero_offset = 0.0;
462 if (climb_dive_ladder)
463 zero_offset = 50.0f; // horizon line is wider by this much (hard coded ??)
467 fntFont *font = _hud->_font_renderer->getFont(); // FIXME
468 float pointsize = _hud->_font_renderer->getPointSize();
469 float italic = _hud->_font_renderer->getSlant();
471 _locTextList.setFont(_hud->_font_renderer);
472 _locTextList.erase();
473 _locLineList.erase();
474 _locStippleLineList.erase();
476 int last = int(_vmax) + 1;
482 for (; i < last; i++) {
483 y = (i - pitch_value) * _compression + .5f;
485 if (!(i % _div_units)) { // At integral multiple of div
486 snprintf(buf, BUFSIZE, "%d", i);
487 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
488 label_length = right + left;
489 label_height = (top + bot) / 2.0f;
494 // Make zero point wider on left
496 x_ini -= zero_offset;
498 // Zero or above draw solid lines
499 draw_line(x_ini, y, x_end, y);
501 if (i == 90 && _zenith)
504 // Below zero draw dashed lines.
505 draw_stipple_line(x_ini, y, x_end, y);
507 if (i == -90 && _nadir)
511 // Calculate the position of the left text and write it.
512 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
513 draw_text(x_end + text_offset, y - label_height, buf);
517 } else { // if (_scr_hole)
518 // Draw ladder with space in the middle of the lines
519 float hole = _scr_hole / 2.0f;
521 x_end = -half_span + hole;
522 x_ini2 = half_span - hole;
524 for (; i < last; i++) {
526 y = float(i - pitch_value) * _compression + .5;
527 else // _type == CLIMB_DIVE
528 y = float(i - actslope) * _compression + .5;
530 if (!(i % _div_units)) { // At integral multiple of div
531 snprintf(buf, BUFSIZE, "%d", i);
532 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
533 label_length = right + left;
534 label_height = (top + bot) / 2.0f;
535 //printf("%s -- l %f r %f b %f t %f\n", buf, left, right, bot, top);
537 // Start by calculating the points and drawing the
543 // Make zero point wider on left
545 x_ini -= zero_offset;
546 x_end2 += zero_offset;
548 //draw climb bar vertical lines
549 if (climb_dive_ladder) {
550 // Zero or above draw solid lines
551 draw_line(x_end, y - 5.0, x_end, y);
552 draw_line(x_ini2, y - 5.0, x_ini2, y);
554 // draw pitch / climb bar
555 draw_line(x_ini, y, x_end, y);
556 draw_line(x_ini2, y, x_end2, y);
558 if (i == 90 && _zenith)
562 // draw dive bar vertical lines
563 if (climb_dive_ladder) {
564 draw_line(x_end, y + 5.0, x_end, y);
565 draw_line(x_ini2, y + 5.0, x_ini2, y);
568 // draw pitch / dive bars
569 draw_stipple_line(x_ini, y, x_end, y);
570 draw_stipple_line(x_ini2, y, x_end2, y);
572 if (i == -90 && _nadir)
576 // Now calculate the location of the left side label using
577 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
578 draw_text(x_end2 + text_offset, y - label_height, buf);
582 // OBJECT LADDER MARK
584 // ATTRIB - ON CONDITION
585 // draw appraoch glide slope marker
587 if (_glide_slope_marker && ihook) {
588 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
589 -half_span + hole, (_glide_slope - actslope) * _compression);
590 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
591 half_span - hole, (_glide_slope - actslope) * _compression);
601 glEnable(GL_LINE_STIPPLE);
602 glLineStipple(1, 0x00FF);
603 _locStippleLineList.draw();
604 glDisable(GL_LINE_STIPPLE);
606 glDisable(GL_CLIP_PLANE0);
607 glDisable(GL_CLIP_PLANE1);
608 glDisable(GL_CLIP_PLANE2);
610 //*************************************************************
612 //*************************************************************
614 if (_waypoint_marker) {
615 //waypoint marker computation
616 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
618 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
619 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
620 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
621 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
623 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
624 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
625 delx= towp_lat - fromwp_lat;
626 dely = towp_lon - fromwp_lon;
627 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
630 theta = asin(dely / hyp);
634 brg = theta * SGD_RADIANS_TO_DEGREES;
640 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
641 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
643 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
644 // end waypoint marker computation
646 //*********************************************************
647 // OBJECT MOVING RETICLE
650 if (fabs(brg - psi) > 10.0) {
652 glTranslatef(_center_x, _center_y, 0);
653 glTranslatef(vel_x, vel_y, 0);
654 glRotatef(brg - psi, 0.0, 0.0, -1.0);
655 glBegin(GL_LINE_LOOP);
656 glVertex2f(-2.5, 20.0);
657 glVertex2f(-2.5, 30.0);
658 glVertex2f(-5.0, 30.0);
659 glVertex2f(0.0, 35.0);
660 glVertex2f(5.0, 30.0);
661 glVertex2f(2.5, 30.0);
662 glVertex2f(2.5, 20.0);
667 // waypoint marker on heading scale
668 if (fabs(brg - psi) < 12.0) {
670 glBegin(GL_LINE_LOOP);
671 GLfloat x = (brg - psi) * 60 / 25;
672 glVertex2f(x + 320, 240.0);
673 glVertex2f(x + 326, 240.0 - 4);
674 glVertex2f(x + 323, 240.0 - 4);
675 glVertex2f(x + 323, 240.0 - 8);
676 glVertex2f(x + 317, 240.0 - 8);
677 glVertex2f(x + 317, 240.0 - 4);
678 glVertex2f(x + 314, 240.0 - 4);
681 } else { // if (_hat)
682 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
685 glEnable(GL_POINT_SMOOTH);
688 for (int count = 0; count <= 200; count++) {
689 float temp = count * SG_PI * 3 / (200.0 * 2.0);
690 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
691 x1 = x + r * cos(temp1);
692 y1 = y + r * sin(temp1);
697 glDisable(GL_POINT_SMOOTH);
701 } // if _waypoint_marker
706 /******************************************************************/
707 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
709 void HUD::Ladder::draw_zenith(float x, float y)
711 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
712 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
714 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
715 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
717 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
718 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
720 draw_line(x - 3.9, y + 3.9, x - 3.0, y + 1.3);
721 draw_line(x - 3.9, y + 3.9, x - 1.3, y + 3.0);
723 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
724 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
726 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
727 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
729 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
730 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
732 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
733 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
737 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
739 void HUD::Ladder::draw_nadir(float x, float y)
743 draw_circle(x, y, R);
744 draw_line(x, y + R, x, y + 22.5); // line above the circle
745 draw_line(x - R, y, x + R, y); // line at middle of circle
747 float theta = asin(2.5 / R);
748 float theta1 = asin(5.0 / R);
749 float x1, y1, x2, y2;
751 x1 = x + R * cos(theta);
753 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
755 draw_line(x1, y1, x2, y2);
757 x1 = x + R * cos(theta1);
759 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
761 draw_line(x1, y1, x2, y2);
763 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
765 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
767 draw_line(x1, y1, x2, y2);
769 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
771 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
773 draw_line(x1, y1, x2, y2);