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 _frl(n->getBoolValue("enable-fuselage-ref-line")),
55 _target_spot(n->getBoolValue("enable-target-spot")),
56 _target_markers(n->getBoolValue("enable-target-markers")),
57 _velocity_vector(n->getBoolValue("enable-velocity-vector")),
58 _drift_marker(n->getBoolValue("enable-drift-marker")),
59 _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
60 _energy_marker(n->getBoolValue("enable-energy-marker")),
61 _climb_dive_marker(n->getBoolValue("enable-climb-dive-marker")),
62 _glide_slope_marker(n->getBoolValue("enable-glide-slope-marker")),
63 _glide_slope(n->getFloatValue("glide-slope", -4.0)),
64 _energy_worm(n->getBoolValue("enable-energy-marker")),
65 _waypoint_marker(n->getBoolValue("enable-waypoint-marker")),
66 _zenith(n->getBoolValue("enable-zenith")),
67 _nadir(n->getBoolValue("enable-nadir")),
68 _hat(n->getBoolValue("enable-hat"))
70 const char *t = n->getStringValue("type");
71 _type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
76 _vmax = _width_units / 2;
81 void HUD::Ladder::draw(void)
83 if (!_pitch.isValid() || !_roll.isValid())
86 float roll_value = _roll.getFloatValue() * SGD_DEGREES_TO_RADIANS;
87 float pitch_value = _pitch.getFloatValue();
93 if (_type == CLIMB_DIVE) {
97 } else { // _type == PITCH
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);
217 //****************************************************************
218 // OBJECT MOVING RETICLE
219 // TYPE VELOCITY VECTOR
222 draw_circle(vel_x, vel_y, 6);
224 //velocity vector reticle orientation lines
225 glBegin(GL_LINE_STRIP);
226 glVertex2f(vel_x - 12, vel_y);
227 glVertex2f(vel_x - 6, vel_y);
229 glBegin(GL_LINE_STRIP);
230 glVertex2f(vel_x + 12, vel_y);
231 glVertex2f(vel_x + 6, vel_y);
233 glBegin(GL_LINE_STRIP);
234 glVertex2f(vel_x, vel_y + 12);
235 glVertex2f(vel_x, vel_y + 6);
239 int lgear = get__iaux3();
240 int ihook = get__iaux6();
242 // OBJECT MOVING RETICLE
244 // ATTRIB - ON CONDITION
246 // undercarriage status
247 glBegin(GL_LINE_STRIP);
248 glVertex2f(vel_x + 8, vel_y);
249 glVertex2f(vel_x + 8, vel_y - 4);
252 // OBJECT MOVING RETICLE
254 // ATTRIB - ON CONDITION
255 glBegin(GL_LINE_STRIP);
256 glVertex2f(vel_x - 8, vel_y);
257 glVertex2f(vel_x - 8, vel_y - 4);
260 // OBJECT MOVING RETICLE
262 // ATTRIB - ON CONDITION
263 glBegin(GL_LINE_STRIP);
264 glVertex2f(vel_x, vel_y - 6);
265 glVertex2f(vel_x, vel_y - 10);
269 // OBJECT MOVING RETICLE
271 // ATTRIB - ON CONDITION
273 // arrestor hook status
274 glBegin(GL_LINE_STRIP);
275 glVertex2f(vel_x - 4, vel_y - 8);
276 glVertex2f(vel_x, vel_y - 10);
277 glVertex2f(vel_x + 4, vel_y - 8);
281 } // if _velocity_vector
283 // draw hud markers on top of each AI/MP target
284 if (_target_markers) {
285 SGPropertyNode *models = globals->get_props()->getNode("/ai/models", true);
286 for (int i = 0; i < models->nChildren(); i++) {
287 SGPropertyNode *chld = models->getChild(i);
289 name = chld->getName();
290 if (name == "aircraft" || name == "multiplayer") {
291 string callsign = chld->getStringValue("callsign");
292 if (callsign != "") {
293 float h_deg = chld->getFloatValue("radar/h-offset");
294 float v_deg = chld->getFloatValue("radar/v-offset");
295 float pos_x = (h_deg * cos(roll_value) -
296 v_deg * sin(roll_value)) * _compression;
297 float pos_y = (v_deg * cos(roll_value) +
298 h_deg * sin(roll_value)) * _compression;
299 draw_circle(pos_x, pos_y, 8);
305 //***************************************************************
306 // OBJECT MOVING RETICLE
307 // TYPE - SQUARE_BRACKET
308 // ATTRIB - ON CONDITION
311 alpha = get__alpha();
313 if (_alpha_bracket && ihook == 1) {
314 glBegin(GL_LINE_STRIP);
315 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
316 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
317 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
318 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
321 glBegin(GL_LINE_STRIP);
322 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
323 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
324 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
325 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
329 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
330 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
332 //****************************************************************
333 // OBJECT MOVING RETICLE
334 // TYPE ENERGY_MARKERS
336 //energy markers - compute potential slope
337 float pla = get__throttleval();
340 if (_energy_marker) {
341 if (total_vel < 5.0) {
345 t1 = up_vel / total_vel;
346 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
348 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
349 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
350 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
353 glBegin(GL_LINE_STRIP);
354 glVertex2f(vel_x - 20, pot_slope - 5);
355 glVertex2f(vel_x - 15, pot_slope);
356 glVertex2f(vel_x - 20, pot_slope + 5);
359 glBegin(GL_LINE_STRIP);
360 glVertex2f(vel_x + 20, pot_slope - 5);
361 glVertex2f(vel_x + 15, pot_slope);
362 glVertex2f(vel_x + 20, pot_slope + 5);
365 if (pla > (105.0 / 131.0)) {
366 glBegin(GL_LINE_STRIP);
367 glVertex2f(vel_x - 24, pot_slope - 5);
368 glVertex2f(vel_x - 19, pot_slope);
369 glVertex2f(vel_x - 24, pot_slope + 5);
372 glBegin(GL_LINE_STRIP);
373 glVertex2f(vel_x + 24, pot_slope - 5);
374 glVertex2f(vel_x + 19, pot_slope);
375 glVertex2f(vel_x + 24, pot_slope + 5);
380 //**********************************************************
382 // OBJECT STATIC RETICLE
384 // ATTRIB - ON CONDITION
386 int ilcanclaw = get__iaux2();
388 if (_energy_worm && ilcanclaw == 1) {
389 glBegin(GL_LINE_STRIP);
390 glVertex2f(-15, -134);
391 glVertex2f(15, -134);
394 // OBJECT MOVING RETICLE
396 // ATTRIB - ON CONDITION
397 glBegin(GL_LINE_STRIP);
398 glVertex2f(-6, -134);
399 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
400 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
404 // OBJECT MOVING RETICLE
406 // ATTRIB - ON CONDITION
407 glBegin(GL_LINE_LOOP);
408 glVertex2f(-6, actslope * 4.0 - 134);
409 glVertex2f(0, actslope * 4.0 -134 + 3);
410 glVertex2f(6, actslope * 4.0 - 134);
411 glVertex2f(0, actslope * 4.0 -134 -3);
416 //*************************************************************
417 // OBJECT MOVING RETICLE
420 // Draw the locked velocity vector.
421 if (_climb_dive_marker) {
422 glBegin(GL_LINE_LOOP);
423 glVertex2f(-3.0, 0.0 + vel_y);
424 glVertex2f(0.0, 6.0 + vel_y);
425 glVertex2f(3.0, 0.0 + vel_y);
426 glVertex2f(0.0, -6.0 + vel_y);
430 //****************************************************************
432 if (_dynamic_origin) {
433 // ladder moves with alpha/beta offset projected onto horizon
434 // line (so that the horizon line always aligns with the
436 _vmin = pitch_value - _width_units * 0.5f;
437 _vmax = pitch_value + _width_units * 0.5f;
439 // the hud ladder center point should move relative to alpha/beta
440 // however the horizon line should always stay on the horizon. We
441 // project the alpha/beta offset onto the horizon line to get the
443 sgdVec3 p1; // result
444 sgdVec3 p; sgdSetVec3(p, vel_x, vel_y, 0.0);
445 sgdVec3 p0; sgdSetVec3(p0, 0.0, 0.0, 0.0);
446 sgdVec3 d; sgdSetVec3(d, cos(roll_value), sin(roll_value), 0.0);
447 sgdClosestPointToLine( p1, p, p0, d );
448 glTranslatef(p1[0], p1[1], 0);
451 // ladder position is fixed relative to the center of the screen.
452 _vmin = pitch_value - _width_units * 0.5f;
453 _vmax = pitch_value + _width_units * 0.5f;
456 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
457 // FRL marker not rotated - this line shifted below
458 float half_span = _w / 2.0;
459 float y = 0, y_end = 0;
464 const int BUFSIZE = 8;
472 float text_offset = 4.0f;
473 float zero_offset = 0.0;
475 // horizon line is wider by this much (hard coded ??)
478 fntFont *font = _hud->_font_renderer->getFont(); // FIXME
479 float pointsize = _hud->_font_renderer->getPointSize();
480 float italic = _hud->_font_renderer->getSlant();
482 _locTextList.setFont(_hud->_font_renderer);
483 _locTextList.erase();
484 _locLineList.erase();
485 _locStippleLineList.erase();
487 int last = int(_vmax) + 1;
493 for (; i < last; i++) {
494 y = (i - pitch_value) * _compression + .5f;
496 if (!(i % _div_units)) { // At integral multiple of div
497 snprintf(buf, BUFSIZE, "%d", i);
498 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
499 label_length = right + left;
500 label_height = (top + bot) / 2.0f;
505 // Make zero point wider on left
507 x_ini -= zero_offset;
509 // Zero or above draw solid lines
510 draw_line(x_ini, y, x_end, y);
512 if (i == 90 && _zenith)
515 // Below zero draw dashed lines.
516 draw_stipple_line(x_ini, y, x_end, y);
518 if (i == -90 && _nadir)
522 // Calculate the position of the left text and write it.
523 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
524 draw_text(x_end + text_offset, y - label_height, buf);
528 } else { // if (_scr_hole)
529 // Draw ladder with space in the middle of the lines
530 float hole = _scr_hole / 2.0f;
532 x_end = -half_span + hole;
533 x_ini2 = half_span - hole;
535 for (; i < last; i++) {
536 if (_type == PITCH) {
537 y = float(i - pitch_value) * _compression + .5;
539 // _type == CLIMB_DIVE
540 y = float(i - actslope) * _compression + .5;
544 sin(0.5 * i * SG_DEGREES_TO_RADIANS * 3/*hack*/) *
549 if (!(i % _div_units)) { // At integral multiple of div
550 snprintf(buf, BUFSIZE, "%d", i);
551 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
552 label_length = right + left;
553 label_height = (top + bot) / 2.0f;
554 //printf("%s -- l %f r %f b %f t %f\n", buf, left, right, bot, top);
556 // Start by calculating the points and drawing the
562 // Make zero point wider on left
564 x_ini -= zero_offset;
565 x_end2 += zero_offset;
567 //draw climb bar vertical lines
568 draw_line(x_end, y - 5.0, x_end, y);
569 draw_line(x_ini2, y - 5.0, x_ini2, y);
571 // draw pitch / climb bar
572 draw_line(x_ini, y, x_end, y);
573 draw_line(x_ini2, y, x_end2, y);
575 if (i == 90 && _zenith)
579 // draw dive bar vertical lines
580 draw_line(x_end, y + 5.0, x_end, y);
581 draw_line(x_ini2, y + 5.0, x_ini2, y);
583 // draw pitch / dive bars
584 draw_stipple_line(x_ini, y_end, x_end, y);
585 draw_stipple_line(x_ini2, y, x_end2, y_end);
587 if (i == -90 && _nadir)
591 // Now calculate the location of the left side label using
592 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y_end - label_height, buf);
593 draw_text(x_end2 + text_offset, y_end - label_height, buf);
597 // OBJECT LADDER MARK
599 // ATTRIB - ON CONDITION
600 // draw appraoch glide slope marker
602 if (_glide_slope_marker && ihook) {
603 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
604 -half_span + hole, (_glide_slope - actslope) * _compression);
605 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
606 half_span - hole, (_glide_slope - actslope) * _compression);
616 glEnable(GL_LINE_STIPPLE);
617 glLineStipple(1, 0x00FF);
618 _locStippleLineList.draw();
619 glDisable(GL_LINE_STIPPLE);
621 glDisable(GL_CLIP_PLANE0);
622 glDisable(GL_CLIP_PLANE1);
623 glDisable(GL_CLIP_PLANE2);
625 //*************************************************************
627 //*************************************************************
629 if (_waypoint_marker) {
630 //waypoint marker computation
631 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
633 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
634 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
635 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
636 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
638 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
639 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
640 delx= towp_lat - fromwp_lat;
641 dely = towp_lon - fromwp_lon;
642 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
645 theta = asin(dely / hyp);
649 brg = theta * SGD_RADIANS_TO_DEGREES;
655 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
656 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
658 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
659 // end waypoint marker computation
661 //*********************************************************
662 // OBJECT MOVING RETICLE
665 if (fabs(brg - psi) > 10.0) {
667 glTranslatef(_center_x, _center_y, 0);
668 glTranslatef(vel_x, vel_y, 0);
669 glRotatef(brg - psi, 0.0, 0.0, -1.0);
670 glBegin(GL_LINE_LOOP);
671 glVertex2f(-2.5, 20.0);
672 glVertex2f(-2.5, 30.0);
673 glVertex2f(-5.0, 30.0);
674 glVertex2f(0.0, 35.0);
675 glVertex2f(5.0, 30.0);
676 glVertex2f(2.5, 30.0);
677 glVertex2f(2.5, 20.0);
682 // waypoint marker on heading scale
683 if (fabs(brg - psi) < 12.0) {
685 glBegin(GL_LINE_LOOP);
686 GLfloat x = (brg - psi) * 60 / 25;
687 glVertex2f(x + 320, 240.0);
688 glVertex2f(x + 326, 240.0 - 4);
689 glVertex2f(x + 323, 240.0 - 4);
690 glVertex2f(x + 323, 240.0 - 8);
691 glVertex2f(x + 317, 240.0 - 8);
692 glVertex2f(x + 317, 240.0 - 4);
693 glVertex2f(x + 314, 240.0 - 4);
696 } else { // if (_hat)
697 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
700 glEnable(GL_POINT_SMOOTH);
703 for (int count = 0; count <= 200; count++) {
704 float temp = count * SG_PI * 3 / (200.0 * 2.0);
705 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
706 x1 = x + r * cos(temp1);
707 y1 = y + r * sin(temp1);
712 glDisable(GL_POINT_SMOOTH);
716 } // if _waypoint_marker
721 /******************************************************************/
722 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
724 void HUD::Ladder::draw_zenith(float x, float y)
726 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
727 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
729 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
730 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
732 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
733 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
735 draw_line(x - 3.9, y + 3.9, x - 3.0, y + 1.3);
736 draw_line(x - 3.9, y + 3.9, x - 1.3, y + 3.0);
738 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
739 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
741 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
742 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
744 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
745 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
747 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
748 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
752 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
754 void HUD::Ladder::draw_nadir(float x, float y)
758 draw_circle(x, y, R);
759 draw_line(x, y + R, x, y + 22.5); // line above the circle
760 draw_line(x - R, y, x + R, y); // line at middle of circle
762 float theta = asin(2.5 / R);
763 float theta1 = asin(5.0 / R);
764 float x1, y1, x2, y2;
766 x1 = x + R * cos(theta);
768 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
770 draw_line(x1, y1, x2, y2);
772 x1 = x + R * cos(theta1);
774 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
776 draw_line(x1, y1, x2, y2);
778 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
780 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
782 draw_line(x1, y1, x2, y2);
784 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
786 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
788 draw_line(x1, y1, x2, y2);