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.
27 #include <simgear/math/vector.hxx>
28 #include <Main/viewer.hxx>
33 float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; }
34 float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); }
35 float get__Vx() { return fgGetFloat("/velocities/uBody-fps"); }
36 float get__Vy() { return fgGetFloat("/velocities/vBody-fps"); }
37 float get__Vz() { return fgGetFloat("/velocities/wBody-fps"); }
38 float get__Ax() { return fgGetFloat("/acclerations/pilot/x-accel-fps_sec"); }
39 float get__Ay() { return fgGetFloat("/acclerations/pilot/y-accel-fps_sec"); }
40 float get__Az() { return fgGetFloat("/acclerations/pilot/z-accel-fps_sec"); }
41 float get__alpha() { return fgGetFloat("/orientation/alpha-deg"); }
42 float get__beta() { return fgGetFloat("/orientation/side-slip-deg"); }
46 HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
48 _pitch(n->getNode("pitch-input", false)),
49 _roll(n->getNode("roll-input", false)),
50 _width_units(int(n->getFloatValue("display-span"))),
51 _div_units(int(fabs(n->getFloatValue("divisions")))),
52 _scr_hole(fabsf(n->getFloatValue("screen-hole")) * 0.5f),
53 _zero_bar_overlength(n->getFloatValue("zero-bar-overlength", 10)),
54 _dive_bar_angle(n->getBoolValue("enable-dive-bar-angle")),
55 _tick_length(n->getFloatValue("tick-length")),
56 _compression(n->getFloatValue("compression-factor")),
57 _dynamic_origin(n->getBoolValue("enable-dynamic-origin")),
58 _clip_plane(n->getBoolValue("enable-clip-plane")),
59 _frl(n->getBoolValue("enable-fuselage-ref-line")),
60 _target_spot(n->getBoolValue("enable-target-spot")),
61 _target_markers(n->getBoolValue("enable-target-markers")),
62 _velocity_vector(n->getBoolValue("enable-velocity-vector")),
63 _drift_marker(n->getBoolValue("enable-drift-marker")),
64 _alpha_bracket(n->getBoolValue("enable-alpha-bracket")),
65 _energy_marker(n->getBoolValue("enable-energy-marker")),
66 _climb_dive_marker(n->getBoolValue("enable-climb-dive-marker")),
67 _glide_slope_marker(n->getBoolValue("enable-glide-slope-marker")),
68 _glide_slope(n->getFloatValue("glide-slope", -4.0)),
69 _energy_worm(n->getBoolValue("enable-energy-marker")),
70 _waypoint_marker(n->getBoolValue("enable-waypoint-marker")),
71 _zenith(n->getBoolValue("enable-zenith")),
72 _nadir(n->getBoolValue("enable-nadir")),
73 _hat(n->getBoolValue("enable-hat"))
75 const char *t = n->getStringValue("type");
76 _type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
81 _vmax = _width_units / 2;
86 void HUD::Ladder::draw(void)
88 if (!_pitch.isValid() || !_roll.isValid())
91 float roll_value = _roll.getFloatValue() * SGD_DEGREES_TO_RADIANS;
92 float pitch_value = _pitch.getFloatValue();
94 //**************************************************************
96 glTranslatef(_center_x, _center_y, 0);
98 // OBJECT STATIC RETICLE
99 // TYPE FRL (FUSELAGE REFERENCE LINE)
101 // Draw the FRL spot and line
103 #define FRL_DIAMOND_SIZE 2.0
104 glBegin(GL_LINE_LOOP);
105 glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
106 glVertex2f(0.0, FRL_DIAMOND_SIZE);
107 glVertex2f(FRL_DIAMOND_SIZE, 0.0);
108 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
111 glBegin(GL_LINE_STRIP);
112 glVertex2f(0, FRL_DIAMOND_SIZE);
115 #undef FRL_DIAMOND_SIZE
117 // TYPE WATERLINE_MARK (W shaped _ _ ) // TODO (-> HUD_misc.cxx)
120 //****************************************************************
122 // Draw the target spot.
124 #define CENTER_DIAMOND_SIZE 6.0
125 glBegin(GL_LINE_LOOP);
126 glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
127 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
128 glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
129 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
131 #undef CENTER_DIAMOND_SIZE
134 //****************************************************************
135 //velocity vector reticle - computations
136 float xvvr, /* yvvr, */ Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
137 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
138 float up_vel, ground_vel, actslope = 0.0, psi = 0.0;
139 float vel_x = 0.0, vel_y = 0.0, drift;
142 if (_velocity_vector) {
144 alpha = get__alpha();
152 psi = get__heading();
157 total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
158 ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
161 if (ground_vel < 2.0) {
162 if (fabs(up_vel) < 2.0)
165 actslope = (up_vel / fabs(up_vel)) * 90.0;
168 actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
171 xvvr = (-drift * (_compression / globals->get_current_view()->get_aspect_ratio()));
172 // drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
173 // yvvr = (-alpha * _compression);
174 // vel_y = (-alpha * cos(roll_value) + drift * sin(roll_value)) * _compression;
175 // vel_x = (alpha * sin(roll_value) + drift * cos(roll_value))
176 // * (_compression / globals->get_current_view()->get_aspect_ratio());
177 vel_y = -alpha * _compression;
178 vel_x = -drift * (_compression / globals->get_current_view()->get_aspect_ratio());
179 // printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
181 //****************************************************************
182 // OBJECT MOVING RETICLE
183 // TYPE - DRIFT MARKER
187 glBegin(GL_LINE_STRIP);
188 glVertex2f((xvvr * 25 / 120) - 6, -4);
189 glVertex2f(xvvr * 25 / 120, 8);
190 glVertex2f((xvvr * 25 / 120) + 6, -4);
194 //****************************************************************
195 // Clipping coordinates for ladder to be input from xml file
196 // Clip hud ladder. FIXME, these should be configurable, but they
197 // have always been hardcoded here.
199 GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
200 GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
201 GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
203 glClipPlane(GL_CLIP_PLANE0, eqn_top);
204 glEnable(GL_CLIP_PLANE0);
205 glClipPlane(GL_CLIP_PLANE1, eqn_left);
206 glEnable(GL_CLIP_PLANE1);
207 glClipPlane(GL_CLIP_PLANE2, eqn_right);
208 glEnable(GL_CLIP_PLANE2);
211 //****************************************************************
212 // OBJECT MOVING RETICLE
213 // TYPE VELOCITY VECTOR
216 draw_circle(vel_x, vel_y, 6);
218 //velocity vector reticle orientation lines
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 + 12, vel_y);
225 glVertex2f(vel_x + 6, vel_y);
227 glBegin(GL_LINE_STRIP);
228 glVertex2f(vel_x, vel_y + 12);
229 glVertex2f(vel_x, vel_y + 6);
233 int lgear = get__iaux3();
234 int ihook = get__iaux6();
236 // OBJECT MOVING RETICLE
238 // ATTRIB - ON CONDITION
240 // undercarriage status
241 glBegin(GL_LINE_STRIP);
242 glVertex2f(vel_x + 8, vel_y);
243 glVertex2f(vel_x + 8, vel_y - 4);
246 // OBJECT MOVING RETICLE
248 // ATTRIB - ON CONDITION
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, vel_y - 6);
259 glVertex2f(vel_x, vel_y - 10);
263 // OBJECT MOVING RETICLE
265 // ATTRIB - ON CONDITION
267 // arrestor hook status
268 glBegin(GL_LINE_STRIP);
269 glVertex2f(vel_x - 4, vel_y - 8);
270 glVertex2f(vel_x, vel_y - 10);
271 glVertex2f(vel_x + 4, vel_y - 8);
275 } // if _velocity_vector
277 // draw hud markers on top of each AI/MP target
278 if (_target_markers) {
279 SGPropertyNode *models = globals->get_props()->getNode("/ai/models", true);
280 for (int i = 0; i < models->nChildren(); i++) {
281 SGPropertyNode *chld = models->getChild(i);
283 name = chld->getName();
284 if (name == "aircraft" || name == "multiplayer") {
285 string callsign = chld->getStringValue("callsign");
286 if (callsign != "") {
287 float h_deg = chld->getFloatValue("radar/h-offset");
288 float v_deg = chld->getFloatValue("radar/v-offset");
289 float pos_x = (h_deg * cos(roll_value) -
290 v_deg * sin(roll_value)) * _compression;
291 float pos_y = (v_deg * cos(roll_value) +
292 h_deg * sin(roll_value)) * _compression;
293 draw_circle(pos_x, pos_y, 8);
299 //***************************************************************
300 // OBJECT MOVING RETICLE
301 // TYPE - SQUARE_BRACKET
302 // ATTRIB - ON CONDITION
305 alpha = get__alpha();
307 if (_alpha_bracket && ihook == 1) {
308 glBegin(GL_LINE_STRIP);
309 glVertex2f(vel_x - 20, vel_y - (16 - alpha) * _compression);
310 glVertex2f(vel_x - 17, vel_y - (16 - alpha) * _compression);
311 glVertex2f(vel_x - 17, vel_y - (14 - alpha) * _compression);
312 glVertex2f(vel_x - 20, vel_y - (14 - alpha) * _compression);
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);
323 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
324 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
326 //****************************************************************
327 // OBJECT MOVING RETICLE
328 // TYPE ENERGY_MARKERS
330 //energy markers - compute potential slope
331 float pla = get__throttleval();
334 if (_energy_marker) {
335 if (total_vel < 5.0) {
339 t1 = up_vel / total_vel;
340 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
342 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
343 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
344 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
347 glBegin(GL_LINE_STRIP);
348 glVertex2f(vel_x - 20, pot_slope - 5);
349 glVertex2f(vel_x - 15, pot_slope);
350 glVertex2f(vel_x - 20, pot_slope + 5);
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 if (pla > (105.0 / 131.0)) {
360 glBegin(GL_LINE_STRIP);
361 glVertex2f(vel_x - 24, pot_slope - 5);
362 glVertex2f(vel_x - 19, pot_slope);
363 glVertex2f(vel_x - 24, pot_slope + 5);
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);
374 //**********************************************************
376 // OBJECT STATIC RETICLE
378 // ATTRIB - ON CONDITION
380 int ilcanclaw = get__iaux2();
382 if (_energy_worm && ilcanclaw == 1) {
383 glBegin(GL_LINE_STRIP);
384 glVertex2f(-15, -134);
385 glVertex2f(15, -134);
388 // OBJECT MOVING RETICLE
390 // ATTRIB - ON CONDITION
391 glBegin(GL_LINE_STRIP);
392 glVertex2f(-6, -134);
393 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
394 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
398 // OBJECT MOVING RETICLE
400 // ATTRIB - ON CONDITION
401 glBegin(GL_LINE_LOOP);
402 glVertex2f(-6, actslope * 4.0 - 134);
403 glVertex2f(0, actslope * 4.0 -134 + 3);
404 glVertex2f(6, actslope * 4.0 - 134);
405 glVertex2f(0, actslope * 4.0 -134 -3);
410 //*************************************************************
411 // OBJECT MOVING RETICLE
414 // Draw the locked velocity vector.
415 if (_climb_dive_marker) {
416 glBegin(GL_LINE_LOOP);
417 glVertex2f(-3.0, 0.0 + vel_y);
418 glVertex2f(0.0, 6.0 + vel_y);
419 glVertex2f(3.0, 0.0 + vel_y);
420 glVertex2f(0.0, -6.0 + vel_y);
424 //****************************************************************
426 if (_dynamic_origin) {
427 // ladder moves with alpha/beta offset projected onto horizon
428 // line (so that the horizon line always aligns with the
430 _vmin = pitch_value - _width_units * 0.5f;
431 _vmax = pitch_value + _width_units * 0.5f;
433 // the hud ladder center point should move relative to alpha/beta
434 // however the horizon line should always stay on the horizon. We
435 // project the alpha/beta offset onto the horizon line to get the
437 sgdVec3 p1; // result
438 sgdVec3 p; sgdSetVec3(p, vel_x, vel_y, 0.0);
439 sgdVec3 p0; sgdSetVec3(p0, 0.0, 0.0, 0.0);
440 sgdVec3 d; sgdSetVec3(d, cos(roll_value), sin(roll_value), 0.0);
441 sgdClosestPointToLine(p1, p, p0, d);
442 glTranslatef(p1[0], p1[1], 0);
445 // ladder position is fixed relative to the center of the screen.
446 _vmin = pitch_value - _width_units * 0.5f;
447 _vmax = pitch_value + _width_units * 0.5f;
450 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
452 // FRL marker not rotated - this line shifted below
453 float half_span = _w * 0.5f;
455 struct { float x, y; } lo, li, ri, ro, numoffs; // left/right inner/outer
458 _locTextList.setFont(_hud->_font_renderer);
459 _locTextList.erase();
460 _locLineList.erase();
461 _locStippleLineList.erase();
463 for (int i = int(_vmin); i < int(_vmax) + 1; i++) {
468 y = float(i - pitch_value) * _compression + .5;
469 else // _type == CLIMB_DIVE
470 y = float(i - actslope) * _compression + .5;
473 if (i == 90 && _zenith)
476 if (i == -90 && _nadir)
479 // OBJECT LADDER MARK
481 // ATTRIB - ON CONDITION
482 // draw appraoch glide slope marker
484 if (_glide_slope_marker && ihook) {
485 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
486 -half_span + hole, (_glide_slope - actslope) * _compression);
487 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
488 half_span - hole, (_glide_slope - actslope) * _compression);
492 if (i > 85 || i < -85)
498 lo.y = ro.y = li.y = ri.y = y;
503 lo.x -= _zero_bar_overlength;
504 ro.x += _zero_bar_overlength;
507 if (_scr_hole > 0.0f) {
511 if (_dive_bar_angle && i < 0) {
512 float alpha = i * SG_DEGREES_TO_RADIANS * 0.5;
513 float xoffs = (ro.x - ri.x) * cos(alpha);
514 float yoffs = (ro.x - ri.x) * sin(alpha);
517 lo.y = ro.y = li.y + yoffs;
519 numoffs.y = 4 - yoffs * 0.3;
525 draw_line(li.x, li.y, lo.x, lo.y, i < 0);
526 draw_line(ri.x, ri.y, ro.x, ro.y, i < 0);
528 draw_line(lo.x, lo.y, ro.x, ro.y, i < 0);
534 draw_line(li.x, li.y, li.x, li.y + _tick_length);
535 draw_line(ri.x, ri.y, ri.x, ri.y + _tick_length);
536 } else if (i > 0 || _zero_bar_overlength == 0) {
537 if (_tick_length > 0) {
540 draw_line(lo.x, lo.y, lo.x, lo.y - _tick_length);
541 draw_line(ro.x, ro.y, ro.x, ro.y - _tick_length);
543 draw_line(li.x, li.y, li.x, li.y - _tick_length);
544 draw_line(ri.x, ri.y, ri.x, ri.y - _tick_length);
550 std::ostringstream str;
552 const char *num = str.str().c_str();
553 int valign = numoffs.y > 0 ? BOTTOM : numoffs.y < 0 ? TOP : VCENTER;
554 draw_text(lo.x - numoffs.x, lo.y + numoffs.y, num,
555 valign | (numoffs.x == 0 ? CENTER : numoffs.x > 0 ? RIGHT : LEFT));
556 draw_text(ro.x + numoffs.x, lo.y + numoffs.y, num,
557 valign | (numoffs.x == 0 ? CENTER : numoffs.x > 0 ? LEFT : RIGHT));
566 glEnable(GL_LINE_STIPPLE);
567 glLineStipple(1, 0x00FF);
568 _locStippleLineList.draw();
569 glDisable(GL_LINE_STIPPLE);
571 glDisable(GL_CLIP_PLANE0);
572 glDisable(GL_CLIP_PLANE1);
573 glDisable(GL_CLIP_PLANE2);
575 //*************************************************************
577 //*************************************************************
579 if (_waypoint_marker) {
580 //waypoint marker computation
581 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
583 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
584 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
585 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
586 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
588 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
589 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
590 delx= towp_lat - fromwp_lat;
591 dely = towp_lon - fromwp_lon;
592 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
595 theta = asin(dely / hyp);
599 brg = theta * SGD_RADIANS_TO_DEGREES;
605 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
606 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
608 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
609 // end waypoint marker computation
611 //*********************************************************
612 // OBJECT MOVING RETICLE
615 if (fabs(brg - psi) > 10.0) {
617 glTranslatef(_center_x, _center_y, 0);
618 glTranslatef(vel_x, vel_y, 0);
619 glRotatef(brg - psi, 0.0, 0.0, -1.0);
620 glBegin(GL_LINE_LOOP);
621 glVertex2f(-2.5, 20.0);
622 glVertex2f(-2.5, 30.0);
623 glVertex2f(-5.0, 30.0);
624 glVertex2f(0.0, 35.0);
625 glVertex2f(5.0, 30.0);
626 glVertex2f(2.5, 30.0);
627 glVertex2f(2.5, 20.0);
632 // waypoint marker on heading scale
633 if (fabs(brg - psi) < 12.0) {
635 glBegin(GL_LINE_LOOP);
636 GLfloat x = (brg - psi) * 60 / 25;
637 glVertex2f(x + 320, 240.0);
638 glVertex2f(x + 326, 240.0 - 4);
639 glVertex2f(x + 323, 240.0 - 4);
640 glVertex2f(x + 323, 240.0 - 8);
641 glVertex2f(x + 317, 240.0 - 8);
642 glVertex2f(x + 317, 240.0 - 4);
643 glVertex2f(x + 314, 240.0 - 4);
646 } else { // if (_hat)
647 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
650 glEnable(GL_POINT_SMOOTH);
653 for (int count = 0; count <= 200; count++) {
654 float temp = count * SG_PI * 3 / (200.0 * 2.0);
655 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
656 x1 = x + r * cos(temp1);
657 y1 = y + r * sin(temp1);
662 glDisable(GL_POINT_SMOOTH);
666 } // if _waypoint_marker
671 /******************************************************************/
672 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
674 void HUD::Ladder::draw_zenith(float x, float y)
676 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
677 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
679 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
680 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
682 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
683 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
685 draw_line(x - 3.9, y + 3.9, x - 3.0, y + 1.3);
686 draw_line(x - 3.9, y + 3.9, x - 1.3, y + 3.0);
688 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
689 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
691 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
692 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
694 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
695 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
697 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
698 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
702 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
704 void HUD::Ladder::draw_nadir(float x, float y)
708 draw_circle(x, y, R);
709 draw_line(x, y + R, x, y + 22.5); // line above the circle
710 draw_line(x - R, y, x + R, y); // line at middle of circle
712 float theta = asin(2.5 / R);
713 float theta1 = asin(5.0 / R);
714 float x1, y1, x2, y2;
716 x1 = x + R * cos(theta);
718 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
720 draw_line(x1, y1, x2, y2);
722 x1 = x + R * cos(theta1);
724 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
726 draw_line(x1, y1, x2, y2);
728 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
730 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
732 draw_line(x1, y1, x2, y2);
734 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
736 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
738 draw_line(x1, y1, x2, y2);