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 #ifdef ENABLE_SP_FMDS
165 int lgear,wown,wowm,ilcanclaw,ihook;
166 ilcanclaw = get_iaux2();
172 float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
174 if(hudladder_type=="Climb/Dive Ladder") {
175 pitch_ladder = false;
176 climb_dive_ladder = true;
180 // hudladder_type=="Pitch Ladder"
183 climb_dive_ladder = false;
187 //**************************************************************
189 // define (0,0) as center of screen
190 glTranslatef( centroid.x, centroid.y, 0);
192 // OBJECT STATIC RETICLE
195 // Draw the FRL spot and line
197 #define FRL_DIAMOND_SIZE 2.0
198 glBegin(GL_LINE_LOOP);
199 glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
200 glVertex2f(0.0, FRL_DIAMOND_SIZE);
201 glVertex2f( FRL_DIAMOND_SIZE, 0.0);
202 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
204 glBegin(GL_LINE_STRIP);
205 glVertex2f(0, FRL_DIAMOND_SIZE);
208 #undef FRL_DIAMOND_SIZE
210 // TYPE WATERLINE_MARK (W shaped _ _ )
213 //****************************************************************
215 // Draw the target spot.
217 #define CENTER_DIAMOND_SIZE 6.0
218 glBegin(GL_LINE_LOOP);
219 glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
220 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
221 glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
222 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
224 #undef CENTER_DIAMOND_SIZE
227 //****************************************************************
228 //velocity vector reticle - computations
229 if(velocity_vector) {
238 if (psi > 180.0) psi = psi - 360;
240 total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
241 ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
244 if (ground_vel < 2.0) {
245 if (fabs(up_vel) < 2.0) {
248 actslope = (up_vel/fabs(up_vel))*90.0;
251 actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
254 xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
255 (factor/globals->get_current_view()->get_aspect_ratio()));
256 drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
257 yvvr = ((actslope - pitch_value)*factor);
258 vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
259 vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
260 (factor/globals->get_current_view()->get_aspect_ratio());
261 // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
262 //****************************************************************
263 // OBJECT MOVING RETICLE
264 // TYPE - DRIFT MARKER
268 glBegin(GL_LINE_STRIP);
269 glVertex2f((xvvr*25/120)-6, -4);
270 glVertex2f(xvvr*25/120, 8);
271 glVertex2f((xvvr*25/120)+6, -4);
275 //****************************************************************
276 // Clipping coordinates for ladder to be input from xml file
279 glClipPlane(GL_CLIP_PLANE0,eqn_top);
280 glEnable(GL_CLIP_PLANE0);
281 glClipPlane(GL_CLIP_PLANE1,eqn_left);
282 glEnable(GL_CLIP_PLANE1);
283 glClipPlane(GL_CLIP_PLANE2,eqn_right);
284 glEnable(GL_CLIP_PLANE2);
285 // glScissor(-100,-240,200,240);
286 // glEnable(GL_SCISSOR_TEST);
288 //****************************************************************
289 // OBJECT MOVING RETICLE
290 // TYPE VELOCITY VECTOR
293 glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
294 for(count=0; count<50; count++) {
295 cosine = 6 * cos(count * 2 * SGD_PI/50.0);
296 sine = 6 * sin(count * 2 * SGD_PI/50.0);
297 glVertex2f(cosine+vel_x, sine+vel_y);
300 //velocity vector reticle orientation lines
301 glBegin(GL_LINE_STRIP);
302 glVertex2f(vel_x-12, vel_y);
303 glVertex2f(vel_x-6, vel_y);
305 glBegin(GL_LINE_STRIP);
306 glVertex2f(vel_x+12, vel_y);
307 glVertex2f(vel_x+6, vel_y);
309 glBegin(GL_LINE_STRIP);
310 glVertex2f(vel_x, vel_y+12);
311 glVertex2f(vel_x, vel_y+6);
314 #ifdef ENABLE_SP_FMDS
315 // OBJECT MOVING RETICLE
317 // ATTRIB - ON CONDITION
319 // undercarriage status
320 glBegin(GL_LINE_STRIP);
321 glVertex2f(vel_x+8, vel_y);
322 glVertex2f(vel_x+8, vel_y-4);
324 // OBJECT MOVING RETICLE
326 // ATTRIB - ON CONDITION
327 glBegin(GL_LINE_STRIP);
328 glVertex2f(vel_x-8, vel_y);
329 glVertex2f(vel_x-8, vel_y-4);
331 // OBJECT MOVING RETICLE
333 // ATTRIB - ON CONDITION
334 glBegin(GL_LINE_STRIP);
335 glVertex2f(vel_x, vel_y-6);
336 glVertex2f(vel_x, vel_y-10);
340 // OBJECT MOVING RETICLE
342 // ATTRIB - ON CONDITION
344 // arrestor hook status
345 glBegin(GL_LINE_STRIP);
346 glVertex2f(vel_x-4, vel_y-8);
347 glVertex2f(vel_x, vel_y-10);
348 glVertex2f(vel_x+4, vel_y-8);
352 }//if velocity_vector
354 //***************************************************************
355 // OBJECT MOVING RETICLE
356 // TYPE - SQUARE_BRACKET
357 // ATTRIB - ON CONDITION
359 #ifdef ENABLE_SP_FMDS
362 glBegin(GL_LINE_STRIP);
363 glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
364 glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
365 glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
366 glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
368 glBegin(GL_LINE_STRIP);
369 glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
370 glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
371 glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
372 glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
377 //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
378 //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
379 //****************************************************************
380 // OBJECT MOVING RETICLE
381 // TYPE ENERGY_MARKERS
383 //energy markers - compute potential slope
385 if (total_vel < 5.0) {
389 t1 = up_vel/total_vel;
390 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
392 pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
393 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
394 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
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 glBegin(GL_LINE_STRIP);
403 glVertex2f(vel_x+20, pot_slope-5);
404 glVertex2f(vel_x+15, pot_slope);
405 glVertex2f(vel_x+20, pot_slope+5);
407 if (pla > (105.0/131.0)) {
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);
413 glBegin(GL_LINE_STRIP);
414 glVertex2f(vel_x+24, pot_slope-5);
415 glVertex2f(vel_x+19, pot_slope);
416 glVertex2f(vel_x+24, pot_slope+5);
420 //**********************************************************
422 // OBJECT STATIC RETICLE
424 // ATTRIB - ON CONDITION
425 #ifdef ENABLE_SP_FMDS
427 if (ilcanclaw == 1) {
428 glBegin(GL_LINE_STRIP);
429 glVertex2f(-15, -134);
430 glVertex2f(15, -134);
432 // OBJECT MOVING RETICLE
434 // ATTRIB - ON CONDITION
435 glBegin(GL_LINE_STRIP);
436 glVertex2f(-6, -134);
437 glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
438 glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
441 // OBJECT MOVING RETICLE
443 // ATTRIB - ON CONDITION
444 glBegin(GL_LINE_LOOP);
445 glVertex2f(-6, actslope*4.0 - 134);
446 glVertex2f(0, actslope*4.0 -134 +3);
447 glVertex2f(6, actslope*4.0 - 134);
448 glVertex2f(0, actslope*4.0 -134 -3);
453 //*************************************************************
454 // OBJECT MOVING RETICLE
457 // Draw the locked velocity vector.
458 if(climb_dive_marker) {
459 glBegin(GL_LINE_LOOP);
460 glVertex2f( -3.0, 0.0+vel_y);
461 glVertex2f(0.0, 6.0+vel_y);
462 glVertex2f( 3.0, 0.0+vel_y);
463 glVertex2f(0.0, -6.0+vel_y);
467 //****************************************************************
469 if(climb_dive_ladder)
472 vmin = pitch_value - (float)width_units;
473 vmax = pitch_value + (float)width_units;
475 glTranslatef( vel_x, vel_y, 0);
479 // pitch_ladder - Default Hud
482 vmin = pitch_value - (float)width_units * 0.5f;
483 vmax = pitch_value + (float)width_units * 0.5f;
487 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
488 // FRL marker not rotated - this line shifted below
499 float text_offset = 4.0f ;
500 float zero_offset = 0.0;
502 if ( climb_dive_ladder ) {
503 zero_offset = 50.0f ; // horizon line is wider by this much (hard coded ??)
505 zero_offset = 10.0f ;
508 fntFont *font = HUDtext->getFont();
509 float pointsize = HUDtext->getPointSize();
510 float italic = HUDtext->getSlant();
512 TextList.setFont( HUDtext );
515 StippleLineList.erase();
517 int last = FloatToInt(vmax)+1;
518 int i = FloatToInt(vmin);
522 for( ; i<last ; i++ )
525 y = (((float)(i - pitch_value) * factor) + .5f);
526 if( !(i % div_units )) // At integral multiple of div
529 sprintf( TextLadder, "%d", i );
530 font->getBBox ( TextLadder, pointsize, italic,
531 &left, &right, &bot, &top ) ;
532 label_length = right - left;
533 label_length += text_offset;
534 label_height = (top - bot)/2.0f;
540 // Make zero point wider on left
542 x_ini -= zero_offset;
544 // Zero or above draw solid lines
545 Line(x_ini, y, x_end, y);
550 drawZenith(x_ini, x_end,y);
553 // Below zero draw dashed lines.
554 StippleLine(x_ini, y, x_end, y);
560 drawNadir(x_ini, x_end,y);
564 // Calculate the position of the left text and write it.
565 Text( x_ini-label_length, y-label_height, TextLadder );
566 Text( x_end+text_offset, y-label_height, TextLadder );
570 else // if(scr_hole )
571 { // Draw ladder with space in the middle of the lines
572 float hole = (float)((scr_hole)/2.0f);
574 x_end = -half_span + hole;
575 x_ini2= half_span - hole;
576 for( ; i<last ; i++ )
579 if(hudladder_type=="Pitch Ladder")
580 y = (((float)(i - pitch_value) * factor) + .5);
582 if(hudladder_type=="Climb/Dive Ladder")
583 y = (((float)(i - actslope) * factor) + .5);
585 if( !(i % div_units )) { // At integral multiple of div
587 sprintf( TextLadder, "%d", i );
588 font->getBBox ( TextLadder, pointsize, italic,
589 &left, &right, &bot, &top ) ;
590 label_length = right - left;
591 label_length += text_offset;
592 label_height = (top - bot)/2.0f;
593 // printf("l %f r %f b %f t %f\n",left, right, bot, top );
595 // Start by calculating the points and drawing the
602 // Make zero point wider on left
605 x_ini -= zero_offset;
606 x_end2 +=zero_offset;
608 //draw climb bar vertical lines
609 if(climb_dive_ladder)
611 // Zero or above draw solid lines
612 Line(x_end, y-5.0, x_end, y);
613 Line(x_ini2, y-5.0, x_ini2, y);
615 // draw pitch / climb bar
616 Line(x_ini, y, x_end, y);
617 Line(x_ini2, y, x_end2, y);
622 drawZenith(x_ini2, x_end,y);
627 // draw dive bar vertical lines
628 if(climb_dive_ladder)
630 Line(x_end, y+5.0, x_end, y);
631 Line(x_ini2, y+5.0, x_ini2, y);
633 // draw pitch / dive bars
634 StippleLine(x_ini, y, x_end, y);
635 StippleLine(x_ini2, y, x_end2, y);
640 drawNadir(x_ini2, x_end,y);
644 // Now calculate the location of the left side label using
645 Text( x_ini-label_length, y-label_height, TextLadder );
646 Text (x_end2+text_offset, y-label_height, TextLadder );
651 // OBJECT LADDER MARK
653 // ATTRIB - ON CONDITION
654 // draw appraoch glide slope marker
655 #ifdef ENABLE_SP_FMDS
656 if (glide_slope_marker) {
658 Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
659 Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
661 }// if glide_slope_marker
670 glEnable(GL_LINE_STIPPLE);
671 glLineStipple( 1, 0x00FF );
672 StippleLineList.draw( );
673 glDisable(GL_LINE_STIPPLE);
675 glDisable(GL_CLIP_PLANE0);
676 glDisable(GL_CLIP_PLANE1);
677 glDisable(GL_CLIP_PLANE2);
678 // glDisable(GL_SCISSOR_TEST);
680 //*************************************************************
681 //*************************************************************
682 #ifdef ENABLE_SP_FMDS
683 if(waypoint_marker) {
684 //waypoint marker computation
685 float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
687 fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
688 fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
689 towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
690 towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
692 dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
693 delx= towp_lat - fromwp_lat;
694 dely = towp_lon - fromwp_lon;
695 hyp = sqrt(pow(delx,2)+pow(dely,2));
697 theta = asin(dely/hyp);
701 brg = theta*SGD_RADIANS_TO_DEGREES;
702 if (brg > 360.0) brg = 0.0;
703 if (delx < 0) brg = 180 - brg;
705 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
706 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
707 dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
708 // end waypoint marker computation
709 //*********************************************************
710 // OBJECT MOVING RETICLE
714 if (fabs(brg-psi) > 10.0)
717 glTranslatef( centroid.x, centroid.y, 0);
718 glTranslatef( vel_x, vel_y, 0);
719 glRotatef(brg - psi,0.0,0.0,-1.0);
720 glBegin(GL_LINE_LOOP);
721 glVertex2f(-2.5,20.0);
722 glVertex2f(-2.5,30.0);
723 glVertex2f(-5.0,30.0);
724 glVertex2f(0.0,35.0);
725 glVertex2f(5.0,30.0);
726 glVertex2f(2.5,30.0);
727 glVertex2f(2.5,20.0);
732 // waypoint marker on heading scale
733 if (fabs(brg-psi) < 12.0)
737 glBegin(GL_LINE_LOOP);
738 glVertex2f(((brg-psi)*60/25)+320,240.0);
739 glVertex2f(((brg-psi)*60/25)+326,240.0-4);
740 glVertex2f(((brg-psi)*60/25)+323,240.0-4);
741 glVertex2f(((brg-psi)*60/25)+323,240.0-8);
742 glVertex2f(((brg-psi)*60/25)+317,240.0-8);
743 glVertex2f(((brg-psi)*60/25)+317,240.0-4);
744 glVertex2f(((brg-psi)*60/25)+314,240.0-4);
748 float x= (brg-psi)*60/25 + 320, y=240.0, r=5.0;
751 glEnable(GL_POINT_SMOOTH);
755 for(int count=0; count<=200; count++)
757 float temp = count * 3.142 * 3 / (200.0*2.0);
758 float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
759 x1 = x + r * cos(temp1);
760 y1 = y + r * sin(temp1);
766 glDisable(GL_POINT_SMOOTH);
770 } // if waypoint_marker
774 /******************************************************************/
777 // draws the zenith symbol for highest possible climb angle (i,e 90 degree climb angle)
780 drawZenith(float xfirst,float xlast,float yvalue )
783 float xcentre = (xfirst + xlast)/2.0;
784 float ycentre = yvalue;
786 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
787 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
789 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
790 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
792 Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
793 Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
795 Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
796 Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
798 Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
799 Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
801 Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
802 Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
804 Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
805 Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
807 Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
808 Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
815 // draws the nadir symbol for lowest possible dive angle (i,e 90 degree dive angle)
819 drawNadir(float xfirst, float xlast, float yvalue)
822 float xcentre = (xfirst + xlast)/2.0;
823 float ycentre = yvalue;
832 float xcent1, xcent2, ycent1, ycent2;
833 xcent1 = xcentre + r * cos(0.0);
834 ycent1 = ycentre + r * sin(0.0);
835 for(int count=1; count<=400; count++)
837 float temp = count * 2 * 3.142 / 400.0;
838 xcent2 = xcentre + r * cos(temp);
839 ycent2 = ycentre + r * sin(temp);
841 Line(xcent1, ycent1, xcent2, ycent2);
847 xcent2 = xcentre + r * cos(0.0);
848 ycent2 = ycentre + r * sin(0.0);
850 drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
854 Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
856 Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
858 float theta = asin (2.5/7.5);
859 float theta1 = asin(5.0/7.5);
861 x1 = xcentre + r * cos(theta);
864 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
870 x1 = xcentre + r * cos(theta1);
873 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
879 x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
882 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
888 x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
891 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);