10 #include <Aircraft/aircraft.hxx>
11 #include <Include/fg_constants.h>
12 #include <Math/fg_random.h>
13 #include <Math/mat3.h>
14 #include <Math/polar3d.hxx>
15 #include <Scenery/scenery.hxx>
16 #include <Time/fg_timer.hxx>
20 //============ Top of fgTBI_instr class member definitions ==============
33 dual_instr_item( x, y, width, height,
38 BankLimit ((int)(maxBankAngle)),
39 SlewLimit ((int)(maxSlipAngle)),
44 fgTBI_instr :: ~fgTBI_instr() {}
46 fgTBI_instr :: fgTBI_instr( const fgTBI_instr & image):
47 dual_instr_item( (const dual_instr_item &) image),
48 BankLimit( image.BankLimit),
49 SlewLimit( image.SlewLimit),
50 scr_hole ( image.scr_hole )
54 fgTBI_instr & fgTBI_instr ::
55 operator = (const fgTBI_instr & rhs )
57 if( !(this == &rhs)) {
58 dual_instr_item::operator = (rhs);
59 BankLimit = rhs.BankLimit;
60 SlewLimit = rhs.SlewLimit;
61 scr_hole = rhs.scr_hole;
67 // Draws a Turn Bank Indicator on the screen
70 void fgTBI_instr :: draw( void )
72 float bank_angle, sideslip_angle;
73 float ss_const; // sideslip angle pixels per rad
74 float cen_x, cen_y, bank, fspan, tee, hole;
76 int span = get_span();
80 RECT My_box = get_location();
81 POINT centroid = get_centroid();
82 int tee_height = My_box.bottom;
84 bank_angle = current_ch2(); // Roll limit +/- 30 degrees
86 if( bank_angle < -FG_PI_2/3 ) {
87 bank_angle = -FG_PI_2/3;
88 } else if( bank_angle > FG_PI_2/3 ) {
89 bank_angle = FG_PI_2/3;
92 sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
94 if( sideslip_angle < -FG_PI/9 ) {
95 sideslip_angle = -FG_PI/9;
96 } else if( sideslip_angle > FG_PI/9 ) {
97 sideslip_angle = FG_PI/9;
102 bank = bank_angle * RAD_TO_DEG;
106 ss_const = 2 * sideslip_angle * fspan/(FG_2PI/9); // width represents 40 degrees
108 // printf("side_slip: %f fspan: %f\n", sideslip_angle, fspan);
109 // printf("ss_const: %f hole: %f\n", ss_const, hole);
112 glTranslatef(cen_x, cen_y, zero);
113 glRotatef(-bank, zero, zero, 1.0);
119 glVertex2f( -fspan, zero );
120 glVertex2f( fspan, zero );
122 glVertex2f( -fspan, zero );
123 glVertex2f( -hole, zero );
124 glVertex2f( hole, zero );
125 glVertex2f( fspan, zero );
128 glVertex2f( hole, zero );
129 glVertex2f( hole, tee );
130 glVertex2f( -hole, zero );
131 glVertex2f( -hole, tee );
135 glBegin(GL_LINE_LOOP);
136 glVertex2f( ss_const, -hole);
137 glVertex2f( ss_const + hole, zero);
138 glVertex2f( ss_const, hole);
139 glVertex2f( ss_const - hole, zero);