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);
216 // glScissor(-100,-240, 200, 240);
217 // glEnable(GL_SCISSOR_TEST);
220 //****************************************************************
221 // OBJECT MOVING RETICLE
222 // TYPE VELOCITY VECTOR
225 draw_circle(vel_x, vel_y, 6);
227 //velocity vector reticle orientation lines
228 glBegin(GL_LINE_STRIP);
229 glVertex2f(vel_x - 12, vel_y);
230 glVertex2f(vel_x - 6, vel_y);
232 glBegin(GL_LINE_STRIP);
233 glVertex2f(vel_x + 12, vel_y);
234 glVertex2f(vel_x + 6, vel_y);
236 glBegin(GL_LINE_STRIP);
237 glVertex2f(vel_x, vel_y + 12);
238 glVertex2f(vel_x, vel_y + 6);
242 int lgear = get__iaux3();
243 int ihook = get__iaux6();
245 // OBJECT MOVING RETICLE
247 // ATTRIB - ON CONDITION
249 // undercarriage status
250 glBegin(GL_LINE_STRIP);
251 glVertex2f(vel_x + 8, vel_y);
252 glVertex2f(vel_x + 8, vel_y - 4);
255 // OBJECT MOVING RETICLE
257 // ATTRIB - ON CONDITION
258 glBegin(GL_LINE_STRIP);
259 glVertex2f(vel_x - 8, vel_y);
260 glVertex2f(vel_x - 8, vel_y - 4);
263 // OBJECT MOVING RETICLE
265 // ATTRIB - ON CONDITION
266 glBegin(GL_LINE_STRIP);
267 glVertex2f(vel_x, vel_y - 6);
268 glVertex2f(vel_x, vel_y - 10);
272 // OBJECT MOVING RETICLE
274 // ATTRIB - ON CONDITION
276 // arrestor hook status
277 glBegin(GL_LINE_STRIP);
278 glVertex2f(vel_x - 4, vel_y - 8);
279 glVertex2f(vel_x, vel_y - 10);
280 glVertex2f(vel_x + 4, vel_y - 8);
284 } // if _velocity_vector
286 // draw hud markers on top of each AI/MP target
287 if ( _target_markers ) {
288 SGPropertyNode *models
289 = globals->get_props()->getNode("/ai/models", true);
290 for ( int i = 0; i < models->nChildren(); i++ ) {
291 SGPropertyNode *chld = models->getChild(i);
293 name = chld->getName();
294 if ( name == "aircraft" || name == "multiplayer" ) {
295 string callsign = chld->getStringValue("callsign");
296 if ( callsign != "" ) {
297 float h_deg = chld->getFloatValue("radar/h-offset");
298 float v_deg = chld->getFloatValue("radar/v-offset");
299 float pos_x = (h_deg * cos(roll_value) -
300 v_deg * sin(roll_value)) * _compression;
301 float pos_y = (v_deg * cos(roll_value) +
302 h_deg * sin(roll_value)) * _compression;
303 draw_circle(pos_x, pos_y, 8);
309 //***************************************************************
310 // OBJECT MOVING RETICLE
311 // TYPE - SQUARE_BRACKET
312 // ATTRIB - ON CONDITION
315 alpha = get__alpha();
317 if (_alpha_bracket && ihook == 1) {
318 glBegin(GL_LINE_STRIP);
319 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
320 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
321 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
322 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
325 glBegin(GL_LINE_STRIP);
326 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
327 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
328 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
329 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
333 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
334 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
336 //****************************************************************
337 // OBJECT MOVING RETICLE
338 // TYPE ENERGY_MARKERS
340 //energy markers - compute potential slope
341 float pla = get__throttleval();
344 if (_energy_marker) {
345 if (total_vel < 5.0) {
349 t1 = up_vel / total_vel;
350 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
352 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
353 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
354 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
357 glBegin(GL_LINE_STRIP);
358 glVertex2f(vel_x - 20, pot_slope - 5);
359 glVertex2f(vel_x - 15, pot_slope);
360 glVertex2f(vel_x - 20, pot_slope + 5);
363 glBegin(GL_LINE_STRIP);
364 glVertex2f(vel_x + 20, pot_slope - 5);
365 glVertex2f(vel_x + 15, pot_slope);
366 glVertex2f(vel_x + 20, pot_slope + 5);
369 if (pla > (105.0 / 131.0)) {
370 glBegin(GL_LINE_STRIP);
371 glVertex2f(vel_x - 24, pot_slope - 5);
372 glVertex2f(vel_x - 19, pot_slope);
373 glVertex2f(vel_x - 24, pot_slope + 5);
376 glBegin(GL_LINE_STRIP);
377 glVertex2f(vel_x + 24, pot_slope - 5);
378 glVertex2f(vel_x + 19, pot_slope);
379 glVertex2f(vel_x + 24, pot_slope + 5);
384 //**********************************************************
386 // OBJECT STATIC RETICLE
388 // ATTRIB - ON CONDITION
390 int ilcanclaw = get__iaux2();
392 if (_energy_worm && ilcanclaw == 1) {
393 glBegin(GL_LINE_STRIP);
394 glVertex2f(-15, -134);
395 glVertex2f(15, -134);
398 // OBJECT MOVING RETICLE
400 // ATTRIB - ON CONDITION
401 glBegin(GL_LINE_STRIP);
402 glVertex2f(-6, -134);
403 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
404 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
408 // OBJECT MOVING RETICLE
410 // ATTRIB - ON CONDITION
411 glBegin(GL_LINE_LOOP);
412 glVertex2f(-6, actslope * 4.0 - 134);
413 glVertex2f(0, actslope * 4.0 -134 + 3);
414 glVertex2f(6, actslope * 4.0 - 134);
415 glVertex2f(0, actslope * 4.0 -134 -3);
420 //*************************************************************
421 // OBJECT MOVING RETICLE
424 // Draw the locked velocity vector.
425 if (_climb_dive_marker) {
426 glBegin(GL_LINE_LOOP);
427 glVertex2f(-3.0, 0.0 + vel_y);
428 glVertex2f(0.0, 6.0 + vel_y);
429 glVertex2f(3.0, 0.0 + vel_y);
430 glVertex2f(0.0, -6.0 + vel_y);
434 //****************************************************************
436 if (climb_dive_ladder) { // CONFORMAL_HUD
437 _vmin = pitch_value - _width_units;
438 _vmax = pitch_value + _width_units;
439 glTranslatef(vel_x, vel_y, 0);
441 } else { // pitch_ladder - Default Hud
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;
454 const int BUFSIZE = 8;
462 float text_offset = 4.0f;
463 float zero_offset = 0.0;
465 if (climb_dive_ladder)
466 zero_offset = 50.0f; // horizon line is wider by this much (hard coded ??)
470 fntFont *font = _hud->_font_renderer->getFont(); // FIXME
471 float pointsize = _hud->_font_renderer->getPointSize();
472 float italic = _hud->_font_renderer->getSlant();
474 _locTextList.setFont(_hud->_font_renderer);
475 _locTextList.erase();
476 _locLineList.erase();
477 _locStippleLineList.erase();
479 int last = int(_vmax) + 1;
485 for (; i < last; i++) {
486 y = (i - pitch_value) * _compression + .5f;
488 if (!(i % _div_units)) { // At integral multiple of div
489 snprintf(buf, BUFSIZE, "%d", i);
490 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
491 label_length = right + left;
492 label_height = (top + bot) / 2.0f;
497 // Make zero point wider on left
499 x_ini -= zero_offset;
501 // Zero or above draw solid lines
502 draw_line(x_ini, y, x_end, y);
504 if (i == 90 && _zenith)
507 // Below zero draw dashed lines.
508 draw_stipple_line(x_ini, y, x_end, y);
510 if (i == -90 && _nadir)
514 // Calculate the position of the left text and write it.
515 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
516 draw_text(x_end + text_offset, y - label_height, buf);
520 } else { // if (_scr_hole)
521 // Draw ladder with space in the middle of the lines
522 float hole = _scr_hole / 2.0f;
524 x_end = -half_span + hole;
525 x_ini2 = half_span - hole;
527 for (; i < last; i++) {
529 y = float(i - pitch_value) * _compression + .5;
530 else // _type == CLIMB_DIVE
531 y = float(i - actslope) * _compression + .5;
533 if (!(i % _div_units)) { // At integral multiple of div
534 snprintf(buf, BUFSIZE, "%d", i);
535 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
536 label_length = right + left;
537 label_height = (top + bot) / 2.0f;
538 //printf("%s -- l %f r %f b %f t %f\n", buf, left, right, bot, top);
540 // Start by calculating the points and drawing the
546 // Make zero point wider on left
548 x_ini -= zero_offset;
549 x_end2 += zero_offset;
551 //draw climb bar vertical lines
552 if (climb_dive_ladder) {
553 // Zero or above draw solid lines
554 draw_line(x_end, y - 5.0, x_end, y);
555 draw_line(x_ini2, y - 5.0, x_ini2, y);
557 // draw pitch / climb bar
558 draw_line(x_ini, y, x_end, y);
559 draw_line(x_ini2, y, x_end2, y);
561 if (i == 90 && _zenith)
565 // draw dive bar vertical lines
566 if (climb_dive_ladder) {
567 draw_line(x_end, y + 5.0, x_end, y);
568 draw_line(x_ini2, y + 5.0, x_ini2, y);
571 // draw pitch / dive bars
572 draw_stipple_line(x_ini, y, x_end, y);
573 draw_stipple_line(x_ini2, y, x_end2, y);
575 if (i == -90 && _nadir)
579 // Now calculate the location of the left side label using
580 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
581 draw_text(x_end2 + text_offset, y - label_height, buf);
585 // OBJECT LADDER MARK
587 // ATTRIB - ON CONDITION
588 // draw appraoch glide slope marker
590 if (_glide_slope_marker && ihook) {
591 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
592 -half_span + hole, (_glide_slope - actslope) * _compression);
593 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
594 half_span - hole, (_glide_slope - actslope) * _compression);
604 glEnable(GL_LINE_STIPPLE);
605 glLineStipple(1, 0x00FF);
606 _locStippleLineList.draw();
607 glDisable(GL_LINE_STIPPLE);
609 glDisable(GL_CLIP_PLANE0);
610 glDisable(GL_CLIP_PLANE1);
611 glDisable(GL_CLIP_PLANE2);
612 // glDisable(GL_SCISSOR_TEST);
614 //*************************************************************
616 //*************************************************************
618 if (_waypoint_marker) {
619 //waypoint marker computation
620 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
622 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
623 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
624 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
625 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
627 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
628 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
629 delx= towp_lat - fromwp_lat;
630 dely = towp_lon - fromwp_lon;
631 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
634 theta = asin(dely / hyp);
638 brg = theta * SGD_RADIANS_TO_DEGREES;
644 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
645 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
647 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
648 // end waypoint marker computation
650 //*********************************************************
651 // OBJECT MOVING RETICLE
654 if (fabs(brg - psi) > 10.0) {
656 glTranslatef(_center_x, _center_y, 0);
657 glTranslatef(vel_x, vel_y, 0);
658 glRotatef(brg - psi, 0.0, 0.0, -1.0);
659 glBegin(GL_LINE_LOOP);
660 glVertex2f(-2.5, 20.0);
661 glVertex2f(-2.5, 30.0);
662 glVertex2f(-5.0, 30.0);
663 glVertex2f(0.0, 35.0);
664 glVertex2f(5.0, 30.0);
665 glVertex2f(2.5, 30.0);
666 glVertex2f(2.5, 20.0);
671 // waypoint marker on heading scale
672 if (fabs(brg - psi) < 12.0) {
674 glBegin(GL_LINE_LOOP);
675 GLfloat x = (brg - psi) * 60 / 25;
676 glVertex2f(x + 320, 240.0);
677 glVertex2f(x + 326, 240.0 - 4);
678 glVertex2f(x + 323, 240.0 - 4);
679 glVertex2f(x + 323, 240.0 - 8);
680 glVertex2f(x + 317, 240.0 - 8);
681 glVertex2f(x + 317, 240.0 - 4);
682 glVertex2f(x + 314, 240.0 - 4);
685 } else { // if (_hat)
686 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
689 glEnable(GL_POINT_SMOOTH);
692 for (int count = 0; count <= 200; count++) {
693 float temp = count * SG_PI * 3 / (200.0 * 2.0);
694 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
695 x1 = x + r * cos(temp1);
696 y1 = y + r * sin(temp1);
701 glDisable(GL_POINT_SMOOTH);
705 } // if _waypoint_marker
710 /******************************************************************/
711 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
713 void HUD::Ladder::draw_zenith(float x, float y)
715 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
716 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
718 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
719 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
721 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
722 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
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 + 3.0);
727 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
728 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
730 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
731 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
733 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
734 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
736 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
737 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
741 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
743 void HUD::Ladder::draw_nadir(float x, float y)
747 draw_circle(x, y, R);
748 draw_line(x, y + R, x, y + 22.5); // line above the circle
749 draw_line(x - R, y, x + R, y); // line at middle of circle
751 float theta = asin(2.5 / R);
752 float theta1 = asin(5.0 / R);
753 float x1, y1, x2, y2;
755 x1 = x + R * cos(theta);
757 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
759 draw_line(x1, y1, x2, y2);
761 x1 = x + R * cos(theta1);
763 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
765 draw_line(x1, y1, x2, y2);
767 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
769 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
771 draw_line(x1, y1, x2, y2);
773 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
775 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
777 draw_line(x1, y1, x2, y2);