7 //====================== Top of HudLadder Class =======================
8 HudLadder :: HudLadder( string name,
29 float glide_slope_val,
33 int zenithsymbol, //suma
34 int nadirsymbol, //suma
35 int hat_marker): //suma
37 dual_instr_item( x, y, width, height,
42 width_units ( (int)(span_units) ),
43 div_units ( (int)(major_div < 0? -major_div: major_div) ),
44 minor_div ( (int)(minor_div) ),
45 label_pos ( lbl_pos ),
46 scr_hole ( screen_hole ),
47 vmax ( span_units/2 ),
50 hudladder_type ( name ),
52 target_spot ( target ),
53 velocity_vector ( vel_vec ),
54 drift_marker ( drift ),
55 alpha_bracket ( alpha ),
56 energy_marker ( energy ),
57 climb_dive_marker ( climb ),
58 glide_slope_marker ( glide ),
59 glide_slope ( glide_slope_val),
60 energy_worm ( worm_energy),
61 waypoint_marker ( waypoint)
66 zenith= zenithsymbol; //suma
67 nadir=nadirsymbol; //suma
68 hat= hat_marker; //suma
76 HudLadder :: ~HudLadder()
81 HudLadder( const HudLadder & image ) :
82 dual_instr_item ( (dual_instr_item &) image),
83 width_units ( image.width_units ),
84 div_units ( image.div_units ),
85 label_pos ( image.label_pos ),
86 scr_hole ( image.scr_hole ),
89 factor ( image.factor ),
90 hudladder_type ( image.hudladder_type),
92 target_spot ( image.target_spot),
93 velocity_vector ( image.velocity_vector),
94 drift_marker ( image.drift_marker),
95 alpha_bracket ( image.alpha_bracket),
96 energy_marker ( image.energy_marker),
97 climb_dive_marker ( image.climb_dive_marker),
98 glide_slope_marker ( image.glide_slope_marker),
99 glide_slope ( image.glide_slope),
100 energy_worm ( image.energy_worm),
101 waypoint_marker ( image.waypoint_marker)
104 HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
106 if( !(this == &rhs)) {
107 (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
108 width_units = rhs.width_units;
109 div_units = rhs.div_units;
110 label_pos = rhs.label_pos;
111 scr_hole = rhs.scr_hole;
115 hudladder_type = rhs.hudladder_type;
117 velocity_vector = rhs.velocity_vector;
118 drift_marker = rhs.drift_marker;
119 alpha_bracket = rhs.alpha_bracket;
120 energy_marker = rhs.energy_marker;
121 climb_dive_marker = rhs.climb_dive_marker;
122 target_spot = rhs.target_spot;
123 glide_slope_marker = rhs.glide_slope_marker;
124 glide_slope = rhs.glide_slope;
125 energy_worm = rhs.energy_worm;
126 waypoint_marker = rhs.waypoint_marker;
132 // Draws a climb ladder in the center of the HUD
135 void HudLadder :: draw( void )
142 float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
143 up_vel, ground_vel, actslope = 0.0;
144 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
145 t2 = 0.0, psi = 0.0, alpha,pla;
146 float vel_x = 0.0, vel_y = 0.0, drift;
148 bool pitch_ladder = false;
149 bool climb_dive_ladder = false;
150 bool clip_plane = false;
152 GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
153 GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
154 GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
156 POINT centroid = get_centroid();
157 RECT box = get_location();
159 float half_span = box.right / 2.0;
160 float roll_value = current_ch2();
162 pla = get_throttleval();
164 int lgear,wown,wowm,ilcanclaw,ihook;
165 ilcanclaw = get_iaux2();
171 float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
173 if(hudladder_type=="Climb/Dive Ladder") {
174 pitch_ladder = false;
175 climb_dive_ladder = true;
179 // hudladder_type=="Pitch Ladder"
182 climb_dive_ladder = false;
186 //**************************************************************
188 // define (0,0) as center of screen
189 glTranslatef( centroid.x, centroid.y, 0);
191 // OBJECT STATIC RETICLE
194 // Draw the FRL spot and line
196 #define FRL_DIAMOND_SIZE 2.0
197 glBegin(GL_LINE_LOOP);
198 glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
199 glVertex2f(0.0, FRL_DIAMOND_SIZE);
200 glVertex2f( FRL_DIAMOND_SIZE, 0.0);
201 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
203 glBegin(GL_LINE_STRIP);
204 glVertex2f(0, FRL_DIAMOND_SIZE);
207 #undef FRL_DIAMOND_SIZE
209 // TYPE WATERLINE_MARK (W shaped _ _ )
212 //****************************************************************
214 // Draw the target spot.
216 #define CENTER_DIAMOND_SIZE 6.0
217 glBegin(GL_LINE_LOOP);
218 glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
219 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
220 glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
221 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
223 #undef CENTER_DIAMOND_SIZE
226 //****************************************************************
227 //velocity vector reticle - computations
228 if(velocity_vector) {
237 if (psi > 180.0) psi = psi - 360;
239 total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
240 ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
243 if (ground_vel < 2.0) {
244 if (fabs(up_vel) < 2.0) {
247 actslope = (up_vel/fabs(up_vel))*90.0;
250 actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
253 xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
254 (factor/globals->get_current_view()->get_win_ratio()));
255 drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
256 yvvr = ((actslope - pitch_value)*factor);
257 vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
258 vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
259 (factor/globals->get_current_view()->get_win_ratio());
260 // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
261 //****************************************************************
262 // OBJECT MOVING RETICLE
263 // TYPE - DRIFT MARKER
267 glBegin(GL_LINE_STRIP);
268 glVertex2f((xvvr*25/120)-6, -4);
269 glVertex2f(xvvr*25/120, 8);
270 glVertex2f((xvvr*25/120)+6, -4);
274 //****************************************************************
275 // Clipping coordinates for ladder to be input from xml file
278 glClipPlane(GL_CLIP_PLANE0,eqn_top);
279 glEnable(GL_CLIP_PLANE0);
280 glClipPlane(GL_CLIP_PLANE1,eqn_left);
281 glEnable(GL_CLIP_PLANE1);
282 glClipPlane(GL_CLIP_PLANE2,eqn_right);
283 glEnable(GL_CLIP_PLANE2);
284 // glScissor(-100,-240,200,240);
285 // glEnable(GL_SCISSOR_TEST);
287 //****************************************************************
288 // OBJECT MOVING RETICLE
289 // TYPE VELOCITY VECTOR
292 glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
293 for(count=0; count<50; count++) {
294 cosine = 6 * cos(count * 2 * SGD_PI/50.0);
295 sine = 6 * sin(count * 2 * SGD_PI/50.0);
296 glVertex2f(cosine+vel_x, sine+vel_y);
299 //velocity vector reticle orientation lines
300 glBegin(GL_LINE_STRIP);
301 glVertex2f(vel_x-12, vel_y);
302 glVertex2f(vel_x-6, vel_y);
304 glBegin(GL_LINE_STRIP);
305 glVertex2f(vel_x+12, vel_y);
306 glVertex2f(vel_x+6, vel_y);
308 glBegin(GL_LINE_STRIP);
309 glVertex2f(vel_x, vel_y+12);
310 glVertex2f(vel_x, vel_y+6);
313 // OBJECT MOVING RETICLE
315 // ATTRIB - ON CONDITION
317 // undercarriage status
318 glBegin(GL_LINE_STRIP);
319 glVertex2f(vel_x+8, vel_y);
320 glVertex2f(vel_x+8, vel_y-4);
322 // OBJECT MOVING RETICLE
324 // ATTRIB - ON CONDITION
325 glBegin(GL_LINE_STRIP);
326 glVertex2f(vel_x-8, vel_y);
327 glVertex2f(vel_x-8, vel_y-4);
329 // OBJECT MOVING RETICLE
331 // ATTRIB - ON CONDITION
332 glBegin(GL_LINE_STRIP);
333 glVertex2f(vel_x, vel_y-6);
334 glVertex2f(vel_x, vel_y-10);
338 // OBJECT MOVING RETICLE
340 // ATTRIB - ON CONDITION
342 // arrestor hook status
343 glBegin(GL_LINE_STRIP);
344 glVertex2f(vel_x-4, vel_y-8);
345 glVertex2f(vel_x, vel_y-10);
346 glVertex2f(vel_x+4, vel_y-8);
349 }//if velocity_vector
351 //***************************************************************
352 // OBJECT MOVING RETICLE
353 // TYPE - SQUARE_BRACKET
354 // ATTRIB - ON CONDITION
358 glBegin(GL_LINE_STRIP);
359 glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
360 glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
361 glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
362 glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
364 glBegin(GL_LINE_STRIP);
365 glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
366 glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
367 glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
368 glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
372 //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
373 //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
374 //****************************************************************
375 // OBJECT MOVING RETICLE
376 // TYPE ENERGY_MARKERS
378 //energy markers - compute potential slope
380 if (total_vel < 5.0) {
384 t1 = up_vel/total_vel;
385 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
387 pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
388 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
389 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
392 glBegin(GL_LINE_STRIP);
393 glVertex2f(vel_x-20, pot_slope-5);
394 glVertex2f(vel_x-15, pot_slope);
395 glVertex2f(vel_x-20, pot_slope+5);
397 glBegin(GL_LINE_STRIP);
398 glVertex2f(vel_x+20, pot_slope-5);
399 glVertex2f(vel_x+15, pot_slope);
400 glVertex2f(vel_x+20, pot_slope+5);
402 if (pla > (105.0/131.0)) {
403 glBegin(GL_LINE_STRIP);
404 glVertex2f(vel_x-24, pot_slope-5);
405 glVertex2f(vel_x-19, pot_slope);
406 glVertex2f(vel_x-24, pot_slope+5);
408 glBegin(GL_LINE_STRIP);
409 glVertex2f(vel_x+24, pot_slope-5);
410 glVertex2f(vel_x+19, pot_slope);
411 glVertex2f(vel_x+24, pot_slope+5);
415 //**********************************************************
417 // OBJECT STATIC RETICLE
419 // ATTRIB - ON CONDITION
421 if (ilcanclaw == 1) {
422 glBegin(GL_LINE_STRIP);
423 glVertex2f(-15, -134);
424 glVertex2f(15, -134);
426 // OBJECT MOVING RETICLE
428 // ATTRIB - ON CONDITION
429 glBegin(GL_LINE_STRIP);
430 glVertex2f(-6, -134);
431 glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
432 glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
435 // OBJECT MOVING RETICLE
437 // ATTRIB - ON CONDITION
438 glBegin(GL_LINE_LOOP);
439 glVertex2f(-6, actslope*4.0 - 134);
440 glVertex2f(0, actslope*4.0 -134 +3);
441 glVertex2f(6, actslope*4.0 - 134);
442 glVertex2f(0, actslope*4.0 -134 -3);
446 //*************************************************************
447 // OBJECT MOVING RETICLE
450 // Draw the locked velocity vector.
451 if(climb_dive_marker) {
452 glBegin(GL_LINE_LOOP);
453 glVertex2f( -3.0, 0.0+vel_y);
454 glVertex2f(0.0, 6.0+vel_y);
455 glVertex2f( 3.0, 0.0+vel_y);
456 glVertex2f(0.0, -6.0+vel_y);
460 //****************************************************************
462 if(climb_dive_ladder)
465 vmin = pitch_value - (float)width_units;
466 vmax = pitch_value + (float)width_units;
468 glTranslatef( vel_x, vel_y, 0);
472 // pitch_ladder - Default Hud
475 vmin = pitch_value - (float)width_units * 0.5f;
476 vmax = pitch_value + (float)width_units * 0.5f;
480 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
481 // FRL marker not rotated - this line shifted below
492 float text_offset = 4.0f ;
493 float zero_offset = 0.0;
495 if ( climb_dive_ladder ) {
496 zero_offset = 50.0f ; // horizon line is wider by this much (hard coded ??)
498 zero_offset = 10.0f ;
501 fntFont *font = HUDtext->getFont();
502 float pointsize = HUDtext->getPointSize();
503 float italic = HUDtext->getSlant();
505 TextList.setFont( HUDtext );
508 StippleLineList.erase();
510 int last = FloatToInt(vmax)+1;
511 int i = FloatToInt(vmin);
515 for( ; i<last ; i++ )
518 y = (((float)(i - pitch_value) * factor) + .5f);
519 if( !(i % div_units )) // At integral multiple of div
522 sprintf( TextLadder, "%d", i );
523 font->getBBox ( TextLadder, pointsize, italic,
524 &left, &right, &bot, &top ) ;
525 label_length = right - left;
526 label_length += text_offset;
527 label_height = (top - bot)/2.0f;
533 // Make zero point wider on left
535 x_ini -= zero_offset;
537 // Zero or above draw solid lines
538 Line(x_ini, y, x_end, y);
543 drawZenith(x_ini, x_end,y);
546 // Below zero draw dashed lines.
547 StippleLine(x_ini, y, x_end, y);
553 drawNadir(x_ini, x_end,y);
557 // Calculate the position of the left text and write it.
558 Text( x_ini-label_length, y-label_height, TextLadder );
559 Text( x_end+text_offset, y-label_height, TextLadder );
563 else // if(scr_hole )
564 { // Draw ladder with space in the middle of the lines
565 float hole = (float)((scr_hole)/2.0f);
567 x_end = -half_span + hole;
568 x_ini2= half_span - hole;
569 for( ; i<last ; i++ )
572 if(hudladder_type=="Pitch Ladder")
573 y = (((float)(i - pitch_value) * factor) + .5);
575 if(hudladder_type=="Climb/Dive Ladder")
576 y = (((float)(i - actslope) * factor) + .5);
578 if( !(i % div_units )) { // At integral multiple of div
580 sprintf( TextLadder, "%d", i );
581 font->getBBox ( TextLadder, pointsize, italic,
582 &left, &right, &bot, &top ) ;
583 label_length = right - left;
584 label_length += text_offset;
585 label_height = (top - bot)/2.0f;
586 // printf("l %f r %f b %f t %f\n",left, right, bot, top );
588 // Start by calculating the points and drawing the
595 // Make zero point wider on left
598 x_ini -= zero_offset;
599 x_end2 +=zero_offset;
601 //draw climb bar vertical lines
602 if(climb_dive_ladder)
604 // Zero or above draw solid lines
605 Line(x_end, y-5.0, x_end, y);
606 Line(x_ini2, y-5.0, x_ini2, y);
608 // draw pitch / climb bar
609 Line(x_ini, y, x_end, y);
610 Line(x_ini2, y, x_end2, y);
615 drawZenith(x_ini2, x_end,y);
620 // draw dive bar vertical lines
621 if(climb_dive_ladder)
623 Line(x_end, y+5.0, x_end, y);
624 Line(x_ini2, y+5.0, x_ini2, y);
626 // draw pitch / dive bars
627 StippleLine(x_ini, y, x_end, y);
628 StippleLine(x_ini2, y, x_end2, y);
633 drawNadir(x_ini2, x_end,y);
637 // Now calculate the location of the left side label using
638 Text( x_ini-label_length, y-label_height, TextLadder );
639 Text (x_end2+text_offset, y-label_height, TextLadder );
644 // OBJECT LADDER MARK
646 // ATTRIB - ON CONDITION
647 // draw appraoch glide slope marker
648 if (glide_slope_marker) {
650 Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
651 Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
653 }// if glide_slope_marker
661 glEnable(GL_LINE_STIPPLE);
662 glLineStipple( 1, 0x00FF );
663 StippleLineList.draw( );
664 glDisable(GL_LINE_STIPPLE);
666 glDisable(GL_CLIP_PLANE0);
667 glDisable(GL_CLIP_PLANE1);
668 glDisable(GL_CLIP_PLANE2);
669 // glDisable(GL_SCISSOR_TEST);
671 //*************************************************************
672 //*************************************************************
673 if(waypoint_marker) {
674 //waypoint marker computation
675 float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
677 fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
678 fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
679 towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
680 towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
682 dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
683 delx= towp_lat - fromwp_lat;
684 dely = towp_lon - fromwp_lon;
685 hyp = sqrt(pow(delx,2)+pow(dely,2));
687 theta = asin(dely/hyp);
691 brg = theta*SGD_RADIANS_TO_DEGREES;
692 if (brg > 360.0) brg = 0.0;
693 if (delx < 0) brg = 180 - brg;
695 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
696 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
697 dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
698 // end waypoint marker computation
699 //*********************************************************
700 // OBJECT MOVING RETICLE
704 if (fabs(brg-psi) > 10.0)
707 glTranslatef( centroid.x, centroid.y, 0);
708 glTranslatef( vel_x, vel_y, 0);
709 glRotatef(brg - psi,0.0,0.0,-1.0);
710 glBegin(GL_LINE_LOOP);
711 glVertex2f(-2.5,20.0);
712 glVertex2f(-2.5,30.0);
713 glVertex2f(-5.0,30.0);
714 glVertex2f(0.0,35.0);
715 glVertex2f(5.0,30.0);
716 glVertex2f(2.5,30.0);
717 glVertex2f(2.5,20.0);
722 // waypoint marker on heading scale
723 if (fabs(brg-psi) < 12.0)
727 glBegin(GL_LINE_LOOP);
728 glVertex2f(((brg-psi)*60/25)+320,240.0);
729 glVertex2f(((brg-psi)*60/25)+326,240.0-4);
730 glVertex2f(((brg-psi)*60/25)+323,240.0-4);
731 glVertex2f(((brg-psi)*60/25)+323,240.0-8);
732 glVertex2f(((brg-psi)*60/25)+317,240.0-8);
733 glVertex2f(((brg-psi)*60/25)+317,240.0-4);
734 glVertex2f(((brg-psi)*60/25)+314,240.0-4);
738 float x= (brg-psi)*60/25 + 320, y=240.0, r=5.0;
741 glEnable(GL_POINT_SMOOTH);
745 for(int count=0; count<=200; count++)
747 float temp = count * 3.142 * 3 / (200.0*2.0);
748 float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
749 x1 = x + r * cos(temp1);
750 y1 = y + r * sin(temp1);
756 glDisable(GL_POINT_SMOOTH);
760 } // if waypoint_marker
763 /******************************************************************/
766 // draws the zenith symbol for highest possible climb angle (i,e 90 degree climb angle)
769 drawZenith(float xfirst,float xlast,float yvalue )
772 float xcentre = (xfirst + xlast)/2.0;
773 float ycentre = yvalue;
775 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
776 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
778 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
779 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
781 Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
782 Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
784 Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
785 Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
787 Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
788 Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
790 Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
791 Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
793 Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
794 Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
796 Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
797 Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
804 // draws the nadir symbol for lowest possible dive angle (i,e 90 degree dive angle)
808 drawNadir(float xfirst, float xlast, float yvalue)
811 float xcentre = (xfirst + xlast)/2.0;
812 float ycentre = yvalue;
817 float x1,y1,x2,y2,xcent,ycent;
822 float xcent1, xcent2, ycent1, ycent2;
823 xcent1 = xcentre + r * cos(0.0);
824 ycent1 = ycentre + r * sin(0.0);
825 for(int count=1; count<=400; count++)
827 float temp = count * 2 * 3.142 / 400.0;
828 xcent2 = xcentre + r * cos(temp);
829 ycent2 = ycentre + r * sin(temp);
831 Line(xcent1, ycent1, xcent2, ycent2);
837 xcent2 = xcentre + r * cos(0.0);
838 ycent2 = ycentre + r * sin(0.0);
840 drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
844 Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
846 Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
848 float theta = asin (2.5/7.5);
849 float theta1 = asin(5.0/7.5);
851 x1 = xcentre + r * cos(theta);
854 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
860 x1 = xcentre + r * cos(theta1);
863 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
869 x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
872 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
878 x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
881 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);