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 _velocity_vector(n->getBoolValue("enable-velocity-vector")),
55 _drift_marker(n->getBoolValue("enable-drift-marker")),
56 _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
57 _energy_marker(n->getBoolValue("enable-energy-marker")),
58 _climb_dive_marker(n->getBoolValue("enable-climb-dive-marker")),
59 _glide_slope_marker(n->getBoolValue("enable-glide-slope-marker")),
60 _glide_slope(n->getFloatValue("glide-slope", -4.0)),
61 _energy_worm(n->getBoolValue("enable-energy-marker")),
62 _waypoint_marker(n->getBoolValue("enable-waypoint-marker")),
63 _zenith(n->getBoolValue("enable-zenith")),
64 _nadir(n->getBoolValue("enable-nadir")),
65 _hat(n->getBoolValue("enable-hat"))
67 const char *t = n->getStringValue("type");
68 _type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
73 _vmax = _width_units / 2;
78 void HUD::Ladder::draw(void)
80 if (!_pitch.isValid() || !_roll.isValid())
83 float roll_value = _roll.getFloatValue() * SGD_DEGREES_TO_RADIANS;
84 float pitch_value = _pitch.getFloatValue();
88 bool climb_dive_ladder;
91 if (_type == CLIMB_DIVE) {
93 climb_dive_ladder = true;
96 } else { // _type == PITCH
98 climb_dive_ladder = false;
102 //**************************************************************
104 glTranslatef(_center_x, _center_y, 0);
106 // OBJECT STATIC RETICLE
107 // TYPE FRL (FUSELAGE REFERENCE LINE)
109 // Draw the FRL spot and line
111 #define FRL_DIAMOND_SIZE 2.0
112 glBegin(GL_LINE_LOOP);
113 glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
114 glVertex2f(0.0, FRL_DIAMOND_SIZE);
115 glVertex2f(FRL_DIAMOND_SIZE, 0.0);
116 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
119 glBegin(GL_LINE_STRIP);
120 glVertex2f(0, FRL_DIAMOND_SIZE);
123 #undef FRL_DIAMOND_SIZE
125 // TYPE WATERLINE_MARK (W shaped _ _ ) // TODO (-> HUD_misc.cxx)
128 //****************************************************************
130 // Draw the target spot.
132 #define CENTER_DIAMOND_SIZE 6.0
133 glBegin(GL_LINE_LOOP);
134 glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
135 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
136 glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
137 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
139 #undef CENTER_DIAMOND_SIZE
142 //****************************************************************
143 //velocity vector reticle - computations
144 float xvvr, /* yvvr, */ Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
145 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
146 float up_vel, ground_vel, actslope = 0.0, psi = 0.0;
147 float vel_x = 0.0, vel_y = 0.0, drift;
149 if (_velocity_vector) {
151 alpha = get__alpha();
159 psi = get__heading();
164 total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
165 ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
168 if (ground_vel < 2.0) {
169 if (fabs(up_vel) < 2.0)
172 actslope = (up_vel / fabs(up_vel)) * 90.0;
175 actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
178 xvvr = (-drift * (_compression / globals->get_current_view()->get_aspect_ratio()));
179 // drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
180 // yvvr = (-alpha * _compression);
181 // vel_y = (-alpha * cos(roll_value) + drift * sin(roll_value)) * _compression;
182 // vel_x = (alpha * sin(roll_value) + drift * cos(roll_value))
183 // * (_compression / globals->get_current_view()->get_aspect_ratio());
184 vel_y = -alpha * _compression;
185 vel_x = -drift * (_compression / globals->get_current_view()->get_aspect_ratio());
186 // printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
188 //****************************************************************
189 // OBJECT MOVING RETICLE
190 // TYPE - DRIFT MARKER
194 glBegin(GL_LINE_STRIP);
195 glVertex2f((xvvr * 25 / 120) - 6, -4);
196 glVertex2f(xvvr * 25 / 120, 8);
197 glVertex2f((xvvr * 25 / 120) + 6, -4);
201 //****************************************************************
202 // Clipping coordinates for ladder to be input from xml file
205 GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
206 GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
207 GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
209 glClipPlane(GL_CLIP_PLANE0, eqn_top);
210 glEnable(GL_CLIP_PLANE0);
211 glClipPlane(GL_CLIP_PLANE1, eqn_left);
212 glEnable(GL_CLIP_PLANE1);
213 glClipPlane(GL_CLIP_PLANE2, eqn_right);
214 glEnable(GL_CLIP_PLANE2);
215 // glScissor(-100,-240, 200, 240);
216 // glEnable(GL_SCISSOR_TEST);
219 //****************************************************************
220 // OBJECT MOVING RETICLE
221 // TYPE VELOCITY VECTOR
224 draw_circle(vel_x, vel_y, 6);
226 //velocity vector reticle orientation lines
227 glBegin(GL_LINE_STRIP);
228 glVertex2f(vel_x - 12, vel_y);
229 glVertex2f(vel_x - 6, vel_y);
231 glBegin(GL_LINE_STRIP);
232 glVertex2f(vel_x + 12, vel_y);
233 glVertex2f(vel_x + 6, vel_y);
235 glBegin(GL_LINE_STRIP);
236 glVertex2f(vel_x, vel_y + 12);
237 glVertex2f(vel_x, vel_y + 6);
241 int lgear = get__iaux3();
242 int ihook = get__iaux6();
244 // OBJECT MOVING RETICLE
246 // ATTRIB - ON CONDITION
248 // undercarriage status
249 glBegin(GL_LINE_STRIP);
250 glVertex2f(vel_x + 8, vel_y);
251 glVertex2f(vel_x + 8, vel_y - 4);
254 // OBJECT MOVING RETICLE
256 // ATTRIB - ON CONDITION
257 glBegin(GL_LINE_STRIP);
258 glVertex2f(vel_x - 8, vel_y);
259 glVertex2f(vel_x - 8, vel_y - 4);
262 // OBJECT MOVING RETICLE
264 // ATTRIB - ON CONDITION
265 glBegin(GL_LINE_STRIP);
266 glVertex2f(vel_x, vel_y - 6);
267 glVertex2f(vel_x, vel_y - 10);
271 // OBJECT MOVING RETICLE
273 // ATTRIB - ON CONDITION
275 // arrestor hook status
276 glBegin(GL_LINE_STRIP);
277 glVertex2f(vel_x - 4, vel_y - 8);
278 glVertex2f(vel_x, vel_y - 10);
279 glVertex2f(vel_x + 4, vel_y - 8);
283 } // if _velocity_vector
286 //***************************************************************
287 // OBJECT MOVING RETICLE
288 // TYPE - SQUARE_BRACKET
289 // ATTRIB - ON CONDITION
292 alpha = get__alpha();
294 if (_alpha_bracket && ihook == 1) {
295 glBegin(GL_LINE_STRIP);
296 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
297 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
298 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
299 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
302 glBegin(GL_LINE_STRIP);
303 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
304 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
305 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
306 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
310 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
311 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
313 //****************************************************************
314 // OBJECT MOVING RETICLE
315 // TYPE ENERGY_MARKERS
317 //energy markers - compute potential slope
318 float pla = get__throttleval();
321 if (_energy_marker) {
322 if (total_vel < 5.0) {
326 t1 = up_vel / total_vel;
327 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
329 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
330 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
331 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
334 glBegin(GL_LINE_STRIP);
335 glVertex2f(vel_x - 20, pot_slope - 5);
336 glVertex2f(vel_x - 15, pot_slope);
337 glVertex2f(vel_x - 20, pot_slope + 5);
340 glBegin(GL_LINE_STRIP);
341 glVertex2f(vel_x + 20, pot_slope - 5);
342 glVertex2f(vel_x + 15, pot_slope);
343 glVertex2f(vel_x + 20, pot_slope + 5);
346 if (pla > (105.0 / 131.0)) {
347 glBegin(GL_LINE_STRIP);
348 glVertex2f(vel_x - 24, pot_slope - 5);
349 glVertex2f(vel_x - 19, pot_slope);
350 glVertex2f(vel_x - 24, pot_slope + 5);
353 glBegin(GL_LINE_STRIP);
354 glVertex2f(vel_x + 24, pot_slope - 5);
355 glVertex2f(vel_x + 19, pot_slope);
356 glVertex2f(vel_x + 24, pot_slope + 5);
361 //**********************************************************
363 // OBJECT STATIC RETICLE
365 // ATTRIB - ON CONDITION
367 int ilcanclaw = get__iaux2();
369 if (_energy_worm && ilcanclaw == 1) {
370 glBegin(GL_LINE_STRIP);
371 glVertex2f(-15, -134);
372 glVertex2f(15, -134);
375 // OBJECT MOVING RETICLE
377 // ATTRIB - ON CONDITION
378 glBegin(GL_LINE_STRIP);
379 glVertex2f(-6, -134);
380 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
381 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
385 // OBJECT MOVING RETICLE
387 // ATTRIB - ON CONDITION
388 glBegin(GL_LINE_LOOP);
389 glVertex2f(-6, actslope * 4.0 - 134);
390 glVertex2f(0, actslope * 4.0 -134 + 3);
391 glVertex2f(6, actslope * 4.0 - 134);
392 glVertex2f(0, actslope * 4.0 -134 -3);
397 //*************************************************************
398 // OBJECT MOVING RETICLE
401 // Draw the locked velocity vector.
402 if (_climb_dive_marker) {
403 glBegin(GL_LINE_LOOP);
404 glVertex2f(-3.0, 0.0 + vel_y);
405 glVertex2f(0.0, 6.0 + vel_y);
406 glVertex2f(3.0, 0.0 + vel_y);
407 glVertex2f(0.0, -6.0 + vel_y);
411 //****************************************************************
413 if (climb_dive_ladder) { // CONFORMAL_HUD
414 _vmin = pitch_value - _width_units;
415 _vmax = pitch_value + _width_units;
416 glTranslatef(vel_x, vel_y, 0);
418 } else { // pitch_ladder - Default Hud
419 _vmin = pitch_value - _width_units * 0.5f;
420 _vmax = pitch_value + _width_units * 0.5f;
423 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
424 // FRL marker not rotated - this line shifted below
425 float half_span = _w / 2.0;
431 const int BUFSIZE = 8;
439 float text_offset = 4.0f;
440 float zero_offset = 0.0;
442 if (climb_dive_ladder)
443 zero_offset = 50.0f; // horizon line is wider by this much (hard coded ??)
447 fntFont *font = _hud->_font_renderer->getFont(); // FIXME
448 float pointsize = _hud->_font_renderer->getPointSize();
449 float italic = _hud->_font_renderer->getSlant();
451 _locTextList.setFont(_hud->_font_renderer);
452 _locTextList.erase();
453 _locLineList.erase();
454 _locStippleLineList.erase();
456 int last = int(_vmax) + 1;
462 for (; i < last; i++) {
463 y = (i - pitch_value) * _compression + .5f;
465 if (!(i % _div_units)) { // At integral multiple of div
466 snprintf(buf, BUFSIZE, "%d", i);
467 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
468 label_length = right + left;
469 label_height = (top + bot) / 2.0f;
474 // Make zero point wider on left
476 x_ini -= zero_offset;
478 // Zero or above draw solid lines
479 draw_line(x_ini, y, x_end, y);
481 if (i == 90 && _zenith)
482 draw_zenith(x_ini, x_end, y);
484 // Below zero draw dashed lines.
485 draw_stipple_line(x_ini, y, x_end, y);
487 if (i == -90 && _nadir)
488 draw_nadir(x_ini, x_end, y);
491 // Calculate the position of the left text and write it.
492 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
493 draw_text(x_end + text_offset, y - label_height, buf);
497 } else { // if (_scr_hole)
498 // Draw ladder with space in the middle of the lines
499 float hole = _scr_hole / 2.0f;
501 x_end = -half_span + hole;
502 x_ini2 = half_span - hole;
504 for (; i < last; i++) {
506 y = float(i - pitch_value) * _compression + .5;
507 else // _type == CLIMB_DIVE
508 y = float(i - actslope) * _compression + .5;
510 if (!(i % _div_units)) { // At integral multiple of div
511 snprintf(buf, BUFSIZE, "%d", i);
512 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
513 label_length = right + left;
514 label_height = (top + bot) / 2.0f;
515 //printf("%s -- l %f r %f b %f t %f\n", buf, left, right, bot, top);
517 // Start by calculating the points and drawing the
523 // Make zero point wider on left
525 x_ini -= zero_offset;
526 x_end2 += zero_offset;
528 //draw climb bar vertical lines
529 if (climb_dive_ladder) {
530 // Zero or above draw solid lines
531 draw_line(x_end, y - 5.0, x_end, y);
532 draw_line(x_ini2, y - 5.0, x_ini2, y);
534 // draw pitch / climb bar
535 draw_line(x_ini, y, x_end, y);
536 draw_line(x_ini2, y, x_end2, y);
538 if (i == 90 && _zenith)
539 draw_zenith(x_ini2, x_end, y);
542 // draw dive bar vertical lines
543 if (climb_dive_ladder) {
544 draw_line(x_end, y + 5.0, x_end, y);
545 draw_line(x_ini2, y + 5.0, x_ini2, y);
548 // draw pitch / dive bars
549 draw_stipple_line(x_ini, y, x_end, y);
550 draw_stipple_line(x_ini2, y, x_end2, y);
552 if (i == -90 && _nadir)
553 draw_nadir(x_ini2, x_end, y);
556 // Now calculate the location of the left side label using
557 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
558 draw_text(x_end2 + text_offset, y - label_height, buf);
562 // OBJECT LADDER MARK
564 // ATTRIB - ON CONDITION
565 // draw appraoch glide slope marker
567 if (_glide_slope_marker && ihook) {
568 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
569 -half_span + hole, (_glide_slope - actslope) * _compression);
570 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
571 half_span - hole, (_glide_slope - actslope) * _compression);
581 glEnable(GL_LINE_STIPPLE);
582 glLineStipple(1, 0x00FF);
583 _locStippleLineList.draw();
584 glDisable(GL_LINE_STIPPLE);
586 glDisable(GL_CLIP_PLANE0);
587 glDisable(GL_CLIP_PLANE1);
588 glDisable(GL_CLIP_PLANE2);
589 // glDisable(GL_SCISSOR_TEST);
591 //*************************************************************
593 //*************************************************************
595 if (_waypoint_marker) {
596 //waypoint marker computation
597 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
599 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
600 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
601 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
602 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
604 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
605 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
606 delx= towp_lat - fromwp_lat;
607 dely = towp_lon - fromwp_lon;
608 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
611 theta = asin(dely / hyp);
615 brg = theta * SGD_RADIANS_TO_DEGREES;
621 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
622 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
624 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
625 // end waypoint marker computation
627 //*********************************************************
628 // OBJECT MOVING RETICLE
631 if (fabs(brg - psi) > 10.0) {
633 glTranslatef(_center_x, _center_y, 0);
634 glTranslatef(vel_x, vel_y, 0);
635 glRotatef(brg - psi, 0.0, 0.0, -1.0);
636 glBegin(GL_LINE_LOOP);
637 glVertex2f(-2.5, 20.0);
638 glVertex2f(-2.5, 30.0);
639 glVertex2f(-5.0, 30.0);
640 glVertex2f(0.0, 35.0);
641 glVertex2f(5.0, 30.0);
642 glVertex2f(2.5, 30.0);
643 glVertex2f(2.5, 20.0);
648 // waypoint marker on heading scale
649 if (fabs(brg - psi) < 12.0) {
651 glBegin(GL_LINE_LOOP);
652 glVertex2f(((brg - psi) * 60 / 25) + 320, 240.0);
653 glVertex2f(((brg - psi) * 60 / 25) + 326, 240.0 - 4);
654 glVertex2f(((brg - psi) * 60 / 25) + 323, 240.0 - 4);
655 glVertex2f(((brg - psi) * 60 / 25) + 323, 240.0 - 8);
656 glVertex2f(((brg - psi) * 60 / 25) + 317, 240.0 - 8);
657 glVertex2f(((brg - psi) * 60 / 25) + 317, 240.0 - 4);
658 glVertex2f(((brg - psi) * 60 / 25) + 314, 240.0 - 4);
661 } else { // if (_hat)
662 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
665 glEnable(GL_POINT_SMOOTH);
668 for (int count = 0; count <= 200; count++) {
669 float temp = count * SG_PI * 3 / (200.0 * 2.0);
670 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
671 x1 = x + r * cos(temp1);
672 y1 = y + r * sin(temp1);
677 glDisable(GL_POINT_SMOOTH);
681 } // if _waypoint_marker
686 /******************************************************************/
687 // draws the zenith symbol for highest possible climb angle (i.e. 90 degree climb angle)
689 void HUD::Ladder::draw_zenith(float xfirst, float xlast, float yvalue)
691 float xcentre = (xfirst + xlast) / 2.0;
692 float ycentre = yvalue;
694 draw_line(xcentre - 9.0, ycentre, xcentre - 3.0, ycentre + 1.3);
695 draw_line(xcentre - 9.0, ycentre, xcentre - 3.0, ycentre - 1.3);
697 draw_line(xcentre + 9.0, ycentre, xcentre + 3.0, ycentre + 1.3);
698 draw_line(xcentre + 9.0, ycentre, xcentre + 3.0, ycentre - 1.3);
700 draw_line(xcentre, ycentre + 9.0, xcentre - 1.3, ycentre + 3.0);
701 draw_line(xcentre, ycentre + 9.0, xcentre + 1.3, ycentre + 3.0);
703 draw_line(xcentre - 3.9, ycentre + 3.9, xcentre - 3.0, ycentre + 1.3);
704 draw_line(xcentre - 3.9, ycentre + 3.9, xcentre - 1.3, ycentre + 3.0);
706 draw_line(xcentre + 3.9, ycentre + 3.9, xcentre + 1.3, ycentre+3.0);
707 draw_line(xcentre + 3.9, ycentre + 3.9, xcentre + 3.0, ycentre+1.3);
709 draw_line(xcentre - 3.9, ycentre - 3.9, xcentre - 3.0, ycentre-1.3);
710 draw_line(xcentre - 3.9, ycentre - 3.9, xcentre - 1.3, ycentre-2.6);
712 draw_line(xcentre + 3.9, ycentre - 3.9, xcentre + 3.0, ycentre-1.3);
713 draw_line(xcentre + 3.9, ycentre - 3.9, xcentre + 1.3, ycentre-2.6);
715 draw_line(xcentre - 1.3, ycentre - 2.6, xcentre, ycentre - 27.0);
716 draw_line(xcentre + 1.3, ycentre - 2.6, xcentre, ycentre - 27.0);
720 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
722 void HUD::Ladder::draw_nadir(float xfirst, float xlast, float yvalue)
724 float xcentre = (xfirst + xlast) / 2.0;
725 float ycentre = yvalue;
728 draw_circle(xcentre, ycentre, R);
729 draw_line(xcentre, ycentre + R, xcentre, ycentre + 22.5); // line above the circle
730 draw_line(xcentre - R, ycentre, xcentre + R, ycentre); // line at middle of circle
732 float theta = asin(2.5 / R);
733 float theta1 = asin(5.0 / R);
734 float x1, y1, x2, y2;
736 x1 = xcentre + R * cos(theta);
738 x2 = xcentre + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
740 draw_line(x1, y1, x2, y2);
742 x1 = xcentre + R * cos(theta1);
744 x2 = xcentre + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
746 draw_line(x1, y1, x2, y2);
748 x1 = xcentre + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
750 x2 = xcentre + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
752 draw_line(x1, y1, x2, y2);
754 x1 = xcentre + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
756 x2 = xcentre + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
758 draw_line(x1, y1, x2, y2);