5 //============ Top of fgTBI_instr class member definitions ==============
18 dual_instr_item( x, y, width, height,
23 BankLimit ((int)(maxBankAngle)),
24 SlewLimit ((int)(maxSlipAngle)),
29 fgTBI_instr :: ~fgTBI_instr() {}
31 fgTBI_instr :: fgTBI_instr( const fgTBI_instr & image):
32 dual_instr_item( (const dual_instr_item &) image),
33 BankLimit( image.BankLimit),
34 SlewLimit( image.SlewLimit),
35 scr_hole ( image.scr_hole )
39 fgTBI_instr & fgTBI_instr ::
40 operator = (const fgTBI_instr & rhs )
42 if( !(this == &rhs)) {
43 dual_instr_item::operator = (rhs);
44 BankLimit = rhs.BankLimit;
45 SlewLimit = rhs.SlewLimit;
46 scr_hole = rhs.scr_hole;
52 // Draws a Turn Bank Indicator on the screen
55 void fgTBI_instr :: draw( void )
57 float bank_angle, sideslip_angle;
58 float ss_const; // sideslip angle pixels per rad
59 float cen_x, cen_y, bank, fspan, tee, hole;
61 int span = get_span();
65 RECT My_box = get_location();
66 POINT centroid = get_centroid();
67 int tee_height = My_box.bottom;
69 bank_angle = current_ch2(); // Roll limit +/- 30 degrees
71 if( bank_angle < -FG_PI_2/3 ) {
72 bank_angle = -FG_PI_2/3;
73 } else if( bank_angle > FG_PI_2/3 ) {
74 bank_angle = FG_PI_2/3;
77 sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
79 if( sideslip_angle < -FG_PI/9 ) {
80 sideslip_angle = -FG_PI/9;
81 } else if( sideslip_angle > FG_PI/9 ) {
82 sideslip_angle = FG_PI/9;
87 bank = bank_angle * RAD_TO_DEG;
91 ss_const = 2 * sideslip_angle * fspan/(FG_2PI/9); // width represents 40 degrees
93 // printf("side_slip: %f fspan: %f\n", sideslip_angle, fspan);
94 // printf("ss_const: %f hole: %f\n", ss_const, hole);
97 glTranslatef(cen_x, cen_y, zero);
98 glRotatef(-bank, zero, zero, 1.0);
104 glVertex2f( -fspan, zero );
105 glVertex2f( fspan, zero );
107 glVertex2f( -fspan, zero );
108 glVertex2f( -hole, zero );
109 glVertex2f( hole, zero );
110 glVertex2f( fspan, zero );
113 glVertex2f( hole, zero );
114 glVertex2f( hole, tee );
115 glVertex2f( -hole, zero );
116 glVertex2f( -hole, tee );
120 glBegin(GL_LINE_LOOP);
121 glVertex2f( ss_const, -hole);
122 glVertex2f( ss_const + hole, zero);
123 glVertex2f( ss_const, hole);
124 glVertex2f( ss_const - hole, zero);