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 _climb_dive_ladder(n->getBoolValue("enable-climb-dive-ladder")),
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(n->getIntValue("screen-hole")),
53 _compression(n->getFloatValue("compression-factor")),
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();
91 bool climb_dive_ladder;
94 if (_type == CLIMB_DIVE) {
96 climb_dive_ladder = true;
99 } else { // _type == PITCH
101 if ( _climb_dive_ladder ) {
102 climb_dive_ladder = true;
104 climb_dive_ladder = false;
109 //**************************************************************
111 glTranslatef(_center_x, _center_y, 0);
113 // OBJECT STATIC RETICLE
114 // TYPE FRL (FUSELAGE REFERENCE LINE)
116 // Draw the FRL spot and line
118 #define FRL_DIAMOND_SIZE 2.0
119 glBegin(GL_LINE_LOOP);
120 glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
121 glVertex2f(0.0, FRL_DIAMOND_SIZE);
122 glVertex2f(FRL_DIAMOND_SIZE, 0.0);
123 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
126 glBegin(GL_LINE_STRIP);
127 glVertex2f(0, FRL_DIAMOND_SIZE);
130 #undef FRL_DIAMOND_SIZE
132 // TYPE WATERLINE_MARK (W shaped _ _ ) // TODO (-> HUD_misc.cxx)
135 //****************************************************************
137 // Draw the target spot.
139 #define CENTER_DIAMOND_SIZE 6.0
140 glBegin(GL_LINE_LOOP);
141 glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
142 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
143 glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
144 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
146 #undef CENTER_DIAMOND_SIZE
149 //****************************************************************
150 //velocity vector reticle - computations
151 float xvvr, /* yvvr, */ Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
152 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
153 float up_vel, ground_vel, actslope = 0.0, psi = 0.0;
154 float vel_x = 0.0, vel_y = 0.0, drift;
156 if (_velocity_vector) {
158 alpha = get__alpha();
166 psi = get__heading();
171 total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
172 ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
175 if (ground_vel < 2.0) {
176 if (fabs(up_vel) < 2.0)
179 actslope = (up_vel / fabs(up_vel)) * 90.0;
182 actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
185 xvvr = (-drift * (_compression / globals->get_current_view()->get_aspect_ratio()));
186 // drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
187 // yvvr = (-alpha * _compression);
188 // vel_y = (-alpha * cos(roll_value) + drift * sin(roll_value)) * _compression;
189 // vel_x = (alpha * sin(roll_value) + drift * cos(roll_value))
190 // * (_compression / globals->get_current_view()->get_aspect_ratio());
191 vel_y = -alpha * _compression;
192 vel_x = -drift * (_compression / globals->get_current_view()->get_aspect_ratio());
193 // printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
195 //****************************************************************
196 // OBJECT MOVING RETICLE
197 // TYPE - DRIFT MARKER
201 glBegin(GL_LINE_STRIP);
202 glVertex2f((xvvr * 25 / 120) - 6, -4);
203 glVertex2f(xvvr * 25 / 120, 8);
204 glVertex2f((xvvr * 25 / 120) + 6, -4);
208 //****************************************************************
209 // Clipping coordinates for ladder to be input from xml file
212 GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
213 GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
214 GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
216 glClipPlane(GL_CLIP_PLANE0, eqn_top);
217 glEnable(GL_CLIP_PLANE0);
218 glClipPlane(GL_CLIP_PLANE1, eqn_left);
219 glEnable(GL_CLIP_PLANE1);
220 glClipPlane(GL_CLIP_PLANE2, eqn_right);
221 glEnable(GL_CLIP_PLANE2);
224 //****************************************************************
225 // OBJECT MOVING RETICLE
226 // TYPE VELOCITY VECTOR
229 draw_circle(vel_x, vel_y, 6);
231 //velocity vector reticle orientation lines
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 + 12, vel_y);
238 glVertex2f(vel_x + 6, vel_y);
240 glBegin(GL_LINE_STRIP);
241 glVertex2f(vel_x, vel_y + 12);
242 glVertex2f(vel_x, vel_y + 6);
246 int lgear = get__iaux3();
247 int ihook = get__iaux6();
249 // OBJECT MOVING RETICLE
251 // ATTRIB - ON CONDITION
253 // undercarriage status
254 glBegin(GL_LINE_STRIP);
255 glVertex2f(vel_x + 8, vel_y);
256 glVertex2f(vel_x + 8, vel_y - 4);
259 // OBJECT MOVING RETICLE
261 // ATTRIB - ON CONDITION
262 glBegin(GL_LINE_STRIP);
263 glVertex2f(vel_x - 8, vel_y);
264 glVertex2f(vel_x - 8, vel_y - 4);
267 // OBJECT MOVING RETICLE
269 // ATTRIB - ON CONDITION
270 glBegin(GL_LINE_STRIP);
271 glVertex2f(vel_x, vel_y - 6);
272 glVertex2f(vel_x, vel_y - 10);
276 // OBJECT MOVING RETICLE
278 // ATTRIB - ON CONDITION
280 // arrestor hook status
281 glBegin(GL_LINE_STRIP);
282 glVertex2f(vel_x - 4, vel_y - 8);
283 glVertex2f(vel_x, vel_y - 10);
284 glVertex2f(vel_x + 4, vel_y - 8);
288 } // if _velocity_vector
290 // draw hud markers on top of each AI/MP target
291 if (_target_markers) {
292 SGPropertyNode *models = globals->get_props()->getNode("/ai/models", true);
293 for (int i = 0; i < models->nChildren(); i++) {
294 SGPropertyNode *chld = models->getChild(i);
296 name = chld->getName();
297 if (name == "aircraft" || name == "multiplayer") {
298 string callsign = chld->getStringValue("callsign");
299 if (callsign != "") {
300 float h_deg = chld->getFloatValue("radar/h-offset");
301 float v_deg = chld->getFloatValue("radar/v-offset");
302 float pos_x = (h_deg * cos(roll_value) -
303 v_deg * sin(roll_value)) * _compression;
304 float pos_y = (v_deg * cos(roll_value) +
305 h_deg * sin(roll_value)) * _compression;
306 draw_circle(pos_x, pos_y, 8);
312 //***************************************************************
313 // OBJECT MOVING RETICLE
314 // TYPE - SQUARE_BRACKET
315 // ATTRIB - ON CONDITION
318 alpha = get__alpha();
320 if (_alpha_bracket && ihook == 1) {
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);
328 glBegin(GL_LINE_STRIP);
329 glVertex2f(vel_x + 20, vel_y - (16 - alpha) * _compression);
330 glVertex2f(vel_x + 17, vel_y - (16 - alpha) * _compression);
331 glVertex2f(vel_x + 17, vel_y - (14 - alpha) * _compression);
332 glVertex2f(vel_x + 20, vel_y - (14 - alpha) * _compression);
336 //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
337 //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
339 //****************************************************************
340 // OBJECT MOVING RETICLE
341 // TYPE ENERGY_MARKERS
343 //energy markers - compute potential slope
344 float pla = get__throttleval();
347 if (_energy_marker) {
348 if (total_vel < 5.0) {
352 t1 = up_vel / total_vel;
353 t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
355 pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * _compression + vel_y;
356 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
357 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
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 glBegin(GL_LINE_STRIP);
367 glVertex2f(vel_x + 20, pot_slope - 5);
368 glVertex2f(vel_x + 15, pot_slope);
369 glVertex2f(vel_x + 20, pot_slope + 5);
372 if (pla > (105.0 / 131.0)) {
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);
379 glBegin(GL_LINE_STRIP);
380 glVertex2f(vel_x + 24, pot_slope - 5);
381 glVertex2f(vel_x + 19, pot_slope);
382 glVertex2f(vel_x + 24, pot_slope + 5);
387 //**********************************************************
389 // OBJECT STATIC RETICLE
391 // ATTRIB - ON CONDITION
393 int ilcanclaw = get__iaux2();
395 if (_energy_worm && ilcanclaw == 1) {
396 glBegin(GL_LINE_STRIP);
397 glVertex2f(-15, -134);
398 glVertex2f(15, -134);
401 // OBJECT MOVING RETICLE
403 // ATTRIB - ON CONDITION
404 glBegin(GL_LINE_STRIP);
405 glVertex2f(-6, -134);
406 glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
407 glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
411 // OBJECT MOVING RETICLE
413 // ATTRIB - ON CONDITION
414 glBegin(GL_LINE_LOOP);
415 glVertex2f(-6, actslope * 4.0 - 134);
416 glVertex2f(0, actslope * 4.0 -134 + 3);
417 glVertex2f(6, actslope * 4.0 - 134);
418 glVertex2f(0, actslope * 4.0 -134 -3);
423 //*************************************************************
424 // OBJECT MOVING RETICLE
427 // Draw the locked velocity vector.
428 if (_climb_dive_marker) {
429 glBegin(GL_LINE_LOOP);
430 glVertex2f(-3.0, 0.0 + vel_y);
431 glVertex2f(0.0, 6.0 + vel_y);
432 glVertex2f(3.0, 0.0 + vel_y);
433 glVertex2f(0.0, -6.0 + vel_y);
437 //****************************************************************
439 /*float pos_x = (drift * cos(roll_value) -
440 alpha * sin(roll_value)) * _compression;
441 float pos_y = (alpha * cos(roll_value) +
442 drift * sin(roll_value)) * _compression; */
443 if (climb_dive_ladder) { // CONFORMAL_HUD
444 _vmin = pitch_value - _width_units * 0.5f;
445 _vmax = pitch_value + _width_units * 0.5f;
447 // the hud ladder center point should move relative to alpha/beta
448 // however the horizon line should always stay on the horizon. We
449 // project the alpha/beta offset onto the horizon line to get the
451 sgdVec3 p1; // result
452 sgdVec3 p; sgdSetVec3(p, vel_x, vel_y, 0.0);
453 sgdVec3 p0; sgdSetVec3(p0, 0.0, 0.0, 0.0);
454 sgdVec3 d; sgdSetVec3(d, cos(roll_value), sin(roll_value), 0.0);
455 sgdClosestPointToLine( p1, p, p0, d );
456 glTranslatef(p1[0], p1[1], 0);
458 } else { // pitch_ladder - Default Hud
459 _vmin = pitch_value - _width_units * 0.5f;
460 _vmax = pitch_value + _width_units * 0.5f;
463 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
464 // FRL marker not rotated - this line shifted below
465 float half_span = _w / 2.0;
466 float y = 0, y_end = 0;
471 const int BUFSIZE = 8;
479 float text_offset = 4.0f;
480 float zero_offset = 0.0;
482 if (climb_dive_ladder)
483 zero_offset = 50.0f; // horizon line is wider by this much (hard coded ??)
487 fntFont *font = _hud->_font_renderer->getFont(); // FIXME
488 float pointsize = _hud->_font_renderer->getPointSize();
489 float italic = _hud->_font_renderer->getSlant();
491 _locTextList.setFont(_hud->_font_renderer);
492 _locTextList.erase();
493 _locLineList.erase();
494 _locStippleLineList.erase();
496 int last = int(_vmax) + 1;
502 for (; i < last; i++) {
503 y = (i - pitch_value) * _compression + .5f;
505 if (!(i % _div_units)) { // At integral multiple of div
506 snprintf(buf, BUFSIZE, "%d", i);
507 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
508 label_length = right + left;
509 label_height = (top + bot) / 2.0f;
514 // Make zero point wider on left
516 x_ini -= zero_offset;
518 // Zero or above draw solid lines
519 draw_line(x_ini, y, x_end, y);
521 if (i == 90 && _zenith)
524 // Below zero draw dashed lines.
525 draw_stipple_line(x_ini, y, x_end, y);
527 if (i == -90 && _nadir)
531 // Calculate the position of the left text and write it.
532 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y - label_height, buf);
533 draw_text(x_end + text_offset, y - label_height, buf);
537 } else { // if (_scr_hole)
538 // Draw ladder with space in the middle of the lines
539 float hole = _scr_hole / 2.0f;
541 x_end = -half_span + hole;
542 x_ini2 = half_span - hole;
544 for (; i < last; i++) {
545 if (_type == PITCH) {
546 y = float(i - pitch_value) * _compression + .5;
548 // _type == CLIMB_DIVE
549 y = float(i - actslope) * _compression + .5;
553 sin(0.5 * i * SG_DEGREES_TO_RADIANS * 3/*hack*/) *
558 if (!(i % _div_units)) { // At integral multiple of div
559 snprintf(buf, BUFSIZE, "%d", i);
560 font->getBBox(buf, pointsize, italic, &left, &right, &bot, &top);
561 label_length = right + left;
562 label_height = (top + bot) / 2.0f;
563 //printf("%s -- l %f r %f b %f t %f\n", buf, left, right, bot, top);
565 // Start by calculating the points and drawing the
571 // Make zero point wider on left
573 x_ini -= zero_offset;
574 x_end2 += zero_offset;
576 //draw climb bar vertical lines
577 if (climb_dive_ladder) {
578 // Zero or above draw solid lines
579 draw_line(x_end, y - 5.0, x_end, y);
580 draw_line(x_ini2, y - 5.0, x_ini2, y);
583 // draw pitch / climb bar
584 draw_line(x_ini, y, x_end, y);
585 draw_line(x_ini2, y, x_end2, y);
587 if (i == 90 && _zenith)
591 // draw dive bar vertical lines
592 if (climb_dive_ladder) {
593 draw_line(x_end, y + 5.0, x_end, y);
594 draw_line(x_ini2, y + 5.0, x_ini2, y);
597 // draw pitch / dive bars
598 draw_stipple_line(x_ini, y_end, x_end, y);
599 draw_stipple_line(x_ini2, y, x_end2, y_end);
601 if (i == -90 && _nadir)
605 // Now calculate the location of the left side label using
606 draw_text(x_ini - text_offset - label_length + 2.5/*hack*/, y_end - label_height, buf);
607 draw_text(x_end2 + text_offset, y_end - label_height, buf);
611 // OBJECT LADDER MARK
613 // ATTRIB - ON CONDITION
614 // draw appraoch glide slope marker
616 if (_glide_slope_marker && ihook) {
617 draw_line(-half_span + 15, (_glide_slope - actslope) * _compression,
618 -half_span + hole, (_glide_slope - actslope) * _compression);
619 draw_line(half_span - 15, (_glide_slope - actslope) * _compression,
620 half_span - hole, (_glide_slope - actslope) * _compression);
630 glEnable(GL_LINE_STIPPLE);
631 glLineStipple(1, 0x00FF);
632 _locStippleLineList.draw();
633 glDisable(GL_LINE_STIPPLE);
635 glDisable(GL_CLIP_PLANE0);
636 glDisable(GL_CLIP_PLANE1);
637 glDisable(GL_CLIP_PLANE2);
639 //*************************************************************
641 //*************************************************************
643 if (_waypoint_marker) {
644 //waypoint marker computation
645 float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
647 fromwp_lon = get__longitude() * SGD_DEGREES_TO_RADIANS;
648 fromwp_lat = get__latitude() * SGD_DEGREES_TO_RADIANS;
649 towp_lon = get__aux2() * SGD_DEGREES_TO_RADIANS;
650 towp_lat = get__aux1() * SGD_DEGREES_TO_RADIANS;
652 dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
653 * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
654 delx= towp_lat - fromwp_lat;
655 dely = towp_lon - fromwp_lon;
656 hyp = sqrt(pow(delx, 2) + pow(dely, 2));
659 theta = asin(dely / hyp);
663 brg = theta * SGD_RADIANS_TO_DEGREES;
669 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
670 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
672 dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
673 // end waypoint marker computation
675 //*********************************************************
676 // OBJECT MOVING RETICLE
679 if (fabs(brg - psi) > 10.0) {
681 glTranslatef(_center_x, _center_y, 0);
682 glTranslatef(vel_x, vel_y, 0);
683 glRotatef(brg - psi, 0.0, 0.0, -1.0);
684 glBegin(GL_LINE_LOOP);
685 glVertex2f(-2.5, 20.0);
686 glVertex2f(-2.5, 30.0);
687 glVertex2f(-5.0, 30.0);
688 glVertex2f(0.0, 35.0);
689 glVertex2f(5.0, 30.0);
690 glVertex2f(2.5, 30.0);
691 glVertex2f(2.5, 20.0);
696 // waypoint marker on heading scale
697 if (fabs(brg - psi) < 12.0) {
699 glBegin(GL_LINE_LOOP);
700 GLfloat x = (brg - psi) * 60 / 25;
701 glVertex2f(x + 320, 240.0);
702 glVertex2f(x + 326, 240.0 - 4);
703 glVertex2f(x + 323, 240.0 - 4);
704 glVertex2f(x + 323, 240.0 - 8);
705 glVertex2f(x + 317, 240.0 - 8);
706 glVertex2f(x + 317, 240.0 - 4);
707 glVertex2f(x + 314, 240.0 - 4);
710 } else { // if (_hat)
711 float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
714 glEnable(GL_POINT_SMOOTH);
717 for (int count = 0; count <= 200; count++) {
718 float temp = count * SG_PI * 3 / (200.0 * 2.0);
719 float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
720 x1 = x + r * cos(temp1);
721 y1 = y + r * sin(temp1);
726 glDisable(GL_POINT_SMOOTH);
730 } // if _waypoint_marker
735 /******************************************************************/
736 // draws the zenith symbol (highest possible climb angle i.e. 90 degree climb angle)
738 void HUD::Ladder::draw_zenith(float x, float y)
740 draw_line(x - 9.0, y, x - 3.0, y + 1.3);
741 draw_line(x - 9.0, y, x - 3.0, y - 1.3);
743 draw_line(x + 9.0, y, x + 3.0, y + 1.3);
744 draw_line(x + 9.0, y, x + 3.0, y - 1.3);
746 draw_line(x, y + 9.0, x - 1.3, y + 3.0);
747 draw_line(x, y + 9.0, x + 1.3, y + 3.0);
749 draw_line(x - 3.9, y + 3.9, x - 3.0, y + 1.3);
750 draw_line(x - 3.9, y + 3.9, x - 1.3, y + 3.0);
752 draw_line(x + 3.9, y + 3.9, x + 1.3, y + 3.0);
753 draw_line(x + 3.9, y + 3.9, x + 3.0, y + 1.3);
755 draw_line(x - 3.9, y - 3.9, x - 3.0, y - 1.3);
756 draw_line(x - 3.9, y - 3.9, x - 1.3, y - 2.6);
758 draw_line(x + 3.9, y - 3.9, x + 3.0, y - 1.3);
759 draw_line(x + 3.9, y - 3.9, x + 1.3, y - 2.6);
761 draw_line(x - 1.3, y - 2.6, x, y - 27.0);
762 draw_line(x + 1.3, y - 2.6, x, y - 27.0);
766 // draws the nadir symbol (lowest possible dive angle i.e. 90 degree dive angle))
768 void HUD::Ladder::draw_nadir(float x, float y)
772 draw_circle(x, y, R);
773 draw_line(x, y + R, x, y + 22.5); // line above the circle
774 draw_line(x - R, y, x + R, y); // line at middle of circle
776 float theta = asin(2.5 / R);
777 float theta1 = asin(5.0 / R);
778 float x1, y1, x2, y2;
780 x1 = x + R * cos(theta);
782 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
784 draw_line(x1, y1, x2, y2);
786 x1 = x + R * cos(theta1);
788 x2 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
790 draw_line(x1, y1, x2, y2);
792 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
794 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
796 draw_line(x1, y1, x2, y2);
798 x1 = x + R * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
800 x2 = x + R * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
802 draw_line(x1, y1, x2, y2);