6 #include <simgear/constants.h>
13 //====================== Top of HudLadder Class =======================
14 HudLadder :: HudLadder( const string& name,
35 float glide_slope_val,
39 int zenithsymbol, //suma
40 int nadirsymbol, //suma
41 int hat_marker): //suma
43 dual_instr_item( x, y, width, height,
48 width_units ( (int)(span_units) ),
49 div_units ( (int)(major_div < 0? -major_div: major_div) ),
50 minor_div ( (int)(minor_div) ),
51 label_pos ( lbl_pos ),
52 scr_hole ( screen_hole ),
53 vmax ( span_units/2 ),
56 hudladder_type ( name ),
58 target_spot ( target ),
59 velocity_vector ( vel_vec ),
60 drift_marker ( drift ),
61 alpha_bracket ( alpha ),
62 energy_marker ( energy ),
63 climb_dive_marker ( climb ),
64 glide_slope_marker ( glide ),
65 glide_slope ( glide_slope_val),
66 energy_worm ( worm_energy),
67 waypoint_marker ( waypoint)
72 zenith= zenithsymbol; //suma
73 nadir=nadirsymbol; //suma
74 hat= hat_marker; //suma
82 HudLadder :: ~HudLadder()
87 HudLadder( const HudLadder & image ) :
88 dual_instr_item ( (dual_instr_item &) image),
89 width_units ( image.width_units ),
90 div_units ( image.div_units ),
91 label_pos ( image.label_pos ),
92 scr_hole ( image.scr_hole ),
95 factor ( image.factor ),
96 hudladder_type ( image.hudladder_type),
98 target_spot ( image.target_spot),
99 velocity_vector ( image.velocity_vector),
100 drift_marker ( image.drift_marker),
101 alpha_bracket ( image.alpha_bracket),
102 energy_marker ( image.energy_marker),
103 climb_dive_marker ( image.climb_dive_marker),
104 glide_slope_marker ( image.glide_slope_marker),
105 glide_slope ( image.glide_slope),
106 energy_worm ( image.energy_worm),
107 waypoint_marker ( image.waypoint_marker)
110 HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
112 if( !(this == &rhs)) {
113 (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
114 width_units = rhs.width_units;
115 div_units = rhs.div_units;
116 label_pos = rhs.label_pos;
117 scr_hole = rhs.scr_hole;
121 hudladder_type = rhs.hudladder_type;
123 velocity_vector = rhs.velocity_vector;
124 drift_marker = rhs.drift_marker;
125 alpha_bracket = rhs.alpha_bracket;
126 energy_marker = rhs.energy_marker;
127 climb_dive_marker = rhs.climb_dive_marker;
128 target_spot = rhs.target_spot;
129 glide_slope_marker = rhs.glide_slope_marker;
130 glide_slope = rhs.glide_slope;
131 energy_worm = rhs.energy_worm;
132 waypoint_marker = rhs.waypoint_marker;
138 // Draws a climb ladder in the center of the HUD
141 void HudLadder :: draw( void )
148 float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
149 up_vel, ground_vel, actslope = 0.0;
150 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
151 t2 = 0.0, psi = 0.0, alpha,pla;
152 float vel_x = 0.0, vel_y = 0.0, drift;
154 bool pitch_ladder = false;
155 bool climb_dive_ladder = false;
156 bool clip_plane = false;
158 GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
159 GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
160 GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
162 POINT centroid = get_centroid();
163 RECT box = get_location();
165 float half_span = box.right / 2.0;
166 float roll_value = current_ch2();
168 pla = get_throttleval();
170 #ifdef ENABLE_SP_FMDS
171 int lgear,wown,wowm,ilcanclaw,ihook;
172 ilcanclaw = get_iaux2();
178 float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
180 if(hudladder_type=="Climb/Dive Ladder") {
181 pitch_ladder = false;
182 climb_dive_ladder = true;
186 // hudladder_type=="Pitch Ladder"
189 climb_dive_ladder = false;
193 //**************************************************************
195 // define (0,0) as center of screen
196 glTranslatef( centroid.x, centroid.y, 0);
198 // OBJECT STATIC RETICLE
201 // Draw the FRL spot and line
203 #define FRL_DIAMOND_SIZE 2.0
204 glBegin(GL_LINE_LOOP);
205 glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
206 glVertex2f(0.0, FRL_DIAMOND_SIZE);
207 glVertex2f( FRL_DIAMOND_SIZE, 0.0);
208 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
210 glBegin(GL_LINE_STRIP);
211 glVertex2f(0, FRL_DIAMOND_SIZE);
214 #undef FRL_DIAMOND_SIZE
216 // TYPE WATERLINE_MARK (W shaped _ _ )
219 //****************************************************************
221 // Draw the target spot.
223 #define CENTER_DIAMOND_SIZE 6.0
224 glBegin(GL_LINE_LOOP);
225 glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
226 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
227 glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
228 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
230 #undef CENTER_DIAMOND_SIZE
233 //****************************************************************
234 //velocity vector reticle - computations
235 if(velocity_vector) {
244 if (psi > 180.0) psi = psi - 360;
246 total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
247 ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
250 if (ground_vel < 2.0) {
251 if (fabs(up_vel) < 2.0) {
254 actslope = (up_vel/fabs(up_vel))*90.0;
257 actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
260 xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
261 (factor/globals->get_current_view()->get_aspect_ratio()));
262 drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
263 yvvr = ((actslope - pitch_value)*factor);
264 vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
265 vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
266 (factor/globals->get_current_view()->get_aspect_ratio());
267 // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
268 //****************************************************************
269 // OBJECT MOVING RETICLE
270 // TYPE - DRIFT MARKER
274 glBegin(GL_LINE_STRIP);
275 glVertex2f((xvvr*25/120)-6, -4);
276 glVertex2f(xvvr*25/120, 8);
277 glVertex2f((xvvr*25/120)+6, -4);
281 //****************************************************************
282 // Clipping coordinates for ladder to be input from xml file
285 glClipPlane(GL_CLIP_PLANE0,eqn_top);
286 glEnable(GL_CLIP_PLANE0);
287 glClipPlane(GL_CLIP_PLANE1,eqn_left);
288 glEnable(GL_CLIP_PLANE1);
289 glClipPlane(GL_CLIP_PLANE2,eqn_right);
290 glEnable(GL_CLIP_PLANE2);
291 // glScissor(-100,-240,200,240);
292 // glEnable(GL_SCISSOR_TEST);
294 //****************************************************************
295 // OBJECT MOVING RETICLE
296 // TYPE VELOCITY VECTOR
299 glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
300 for(count=0; count<50; count++) {
301 cosine = 6 * cos(count * SGD_2PI/50.0);
302 sine = 6 * sin(count * SGD_2PI/50.0);
303 glVertex2f(cosine+vel_x, sine+vel_y);
306 //velocity vector reticle orientation lines
307 glBegin(GL_LINE_STRIP);
308 glVertex2f(vel_x-12, vel_y);
309 glVertex2f(vel_x-6, vel_y);
311 glBegin(GL_LINE_STRIP);
312 glVertex2f(vel_x+12, vel_y);
313 glVertex2f(vel_x+6, vel_y);
315 glBegin(GL_LINE_STRIP);
316 glVertex2f(vel_x, vel_y+12);
317 glVertex2f(vel_x, vel_y+6);
320 #ifdef ENABLE_SP_FMDS
321 // OBJECT MOVING RETICLE
323 // ATTRIB - ON CONDITION
325 // undercarriage status
326 glBegin(GL_LINE_STRIP);
327 glVertex2f(vel_x+8, vel_y);
328 glVertex2f(vel_x+8, vel_y-4);
330 // OBJECT MOVING RETICLE
332 // ATTRIB - ON CONDITION
333 glBegin(GL_LINE_STRIP);
334 glVertex2f(vel_x-8, vel_y);
335 glVertex2f(vel_x-8, vel_y-4);
337 // OBJECT MOVING RETICLE
339 // ATTRIB - ON CONDITION
340 glBegin(GL_LINE_STRIP);
341 glVertex2f(vel_x, vel_y-6);
342 glVertex2f(vel_x, vel_y-10);
346 // OBJECT MOVING RETICLE
348 // ATTRIB - ON CONDITION
350 // arrestor hook status
351 glBegin(GL_LINE_STRIP);
352 glVertex2f(vel_x-4, vel_y-8);
353 glVertex2f(vel_x, vel_y-10);
354 glVertex2f(vel_x+4, vel_y-8);
358 }//if velocity_vector
360 //***************************************************************
361 // OBJECT MOVING RETICLE
362 // TYPE - SQUARE_BRACKET
363 // ATTRIB - ON CONDITION
365 #ifdef ENABLE_SP_FMDS
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);
374 glBegin(GL_LINE_STRIP);
375 glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
376 glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
377 glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
378 glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
383 //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
384 //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
385 //****************************************************************
386 // OBJECT MOVING RETICLE
387 // TYPE ENERGY_MARKERS
389 //energy markers - compute potential slope
391 if (total_vel < 5.0) {
395 t1 = up_vel/total_vel;
396 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
398 pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
399 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
400 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
403 glBegin(GL_LINE_STRIP);
404 glVertex2f(vel_x-20, pot_slope-5);
405 glVertex2f(vel_x-15, pot_slope);
406 glVertex2f(vel_x-20, pot_slope+5);
408 glBegin(GL_LINE_STRIP);
409 glVertex2f(vel_x+20, pot_slope-5);
410 glVertex2f(vel_x+15, pot_slope);
411 glVertex2f(vel_x+20, pot_slope+5);
413 if (pla > (105.0/131.0)) {
414 glBegin(GL_LINE_STRIP);
415 glVertex2f(vel_x-24, pot_slope-5);
416 glVertex2f(vel_x-19, pot_slope);
417 glVertex2f(vel_x-24, pot_slope+5);
419 glBegin(GL_LINE_STRIP);
420 glVertex2f(vel_x+24, pot_slope-5);
421 glVertex2f(vel_x+19, pot_slope);
422 glVertex2f(vel_x+24, pot_slope+5);
426 //**********************************************************
428 // OBJECT STATIC RETICLE
430 // ATTRIB - ON CONDITION
431 #ifdef ENABLE_SP_FMDS
433 if (ilcanclaw == 1) {
434 glBegin(GL_LINE_STRIP);
435 glVertex2f(-15, -134);
436 glVertex2f(15, -134);
438 // OBJECT MOVING RETICLE
440 // ATTRIB - ON CONDITION
441 glBegin(GL_LINE_STRIP);
442 glVertex2f(-6, -134);
443 glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
444 glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
447 // OBJECT MOVING RETICLE
449 // ATTRIB - ON CONDITION
450 glBegin(GL_LINE_LOOP);
451 glVertex2f(-6, actslope*4.0 - 134);
452 glVertex2f(0, actslope*4.0 -134 +3);
453 glVertex2f(6, actslope*4.0 - 134);
454 glVertex2f(0, actslope*4.0 -134 -3);
459 //*************************************************************
460 // OBJECT MOVING RETICLE
463 // Draw the locked velocity vector.
464 if(climb_dive_marker) {
465 glBegin(GL_LINE_LOOP);
466 glVertex2f( -3.0, 0.0+vel_y);
467 glVertex2f(0.0, 6.0+vel_y);
468 glVertex2f( 3.0, 0.0+vel_y);
469 glVertex2f(0.0, -6.0+vel_y);
473 //****************************************************************
475 if(climb_dive_ladder)
478 vmin = pitch_value - (float)width_units;
479 vmax = pitch_value + (float)width_units;
481 glTranslatef( vel_x, vel_y, 0);
485 // pitch_ladder - Default Hud
488 vmin = pitch_value - (float)width_units * 0.5f;
489 vmax = pitch_value + (float)width_units * 0.5f;
493 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
494 // FRL marker not rotated - this line shifted below
505 float text_offset = 4.0f ;
506 float zero_offset = 0.0;
508 if ( climb_dive_ladder ) {
509 zero_offset = 50.0f ; // horizon line is wider by this much (hard coded ??)
511 zero_offset = 10.0f ;
514 fntFont *font = HUDtext->getFont();
515 float pointsize = HUDtext->getPointSize();
516 float italic = HUDtext->getSlant();
518 TextList.setFont( HUDtext );
521 StippleLineList.erase();
523 int last = FloatToInt(vmax)+1;
524 int i = FloatToInt(vmin);
528 for( ; i<last ; i++ )
531 y = (((float)(i - pitch_value) * factor) + .5f);
532 if( !(i % div_units )) // At integral multiple of div
535 sprintf( TextLadder, "%d", i );
536 font->getBBox ( TextLadder, pointsize, italic,
537 &left, &right, &bot, &top ) ;
538 label_length = right - left;
539 label_length += text_offset;
540 label_height = (top - bot)/2.0f;
546 // Make zero point wider on left
548 x_ini -= zero_offset;
550 // Zero or above draw solid lines
551 Line(x_ini, y, x_end, y);
556 drawZenith(x_ini, x_end,y);
559 // Below zero draw dashed lines.
560 StippleLine(x_ini, y, x_end, y);
566 drawNadir(x_ini, x_end,y);
570 // Calculate the position of the left text and write it.
571 Text( x_ini-label_length, y-label_height, TextLadder );
572 Text( x_end+text_offset, y-label_height, TextLadder );
576 else // if(scr_hole )
577 { // Draw ladder with space in the middle of the lines
578 float hole = (float)((scr_hole)/2.0f);
580 x_end = -half_span + hole;
581 x_ini2= half_span - hole;
582 for( ; i<last ; i++ )
585 if(hudladder_type=="Pitch Ladder")
586 y = (((float)(i - pitch_value) * factor) + .5);
588 if(hudladder_type=="Climb/Dive Ladder")
589 y = (((float)(i - actslope) * factor) + .5);
591 if( !(i % div_units )) { // At integral multiple of div
593 sprintf( TextLadder, "%d", i );
594 font->getBBox ( TextLadder, pointsize, italic,
595 &left, &right, &bot, &top ) ;
596 label_length = right - left;
597 label_length += text_offset;
598 label_height = (top - bot)/2.0f;
599 // printf("l %f r %f b %f t %f\n",left, right, bot, top );
601 // Start by calculating the points and drawing the
608 // Make zero point wider on left
611 x_ini -= zero_offset;
612 x_end2 +=zero_offset;
614 //draw climb bar vertical lines
615 if(climb_dive_ladder)
617 // Zero or above draw solid lines
618 Line(x_end, y-5.0, x_end, y);
619 Line(x_ini2, y-5.0, x_ini2, y);
621 // draw pitch / climb bar
622 Line(x_ini, y, x_end, y);
623 Line(x_ini2, y, x_end2, y);
628 drawZenith(x_ini2, x_end,y);
633 // draw dive bar vertical lines
634 if(climb_dive_ladder)
636 Line(x_end, y+5.0, x_end, y);
637 Line(x_ini2, y+5.0, x_ini2, y);
639 // draw pitch / dive bars
640 StippleLine(x_ini, y, x_end, y);
641 StippleLine(x_ini2, y, x_end2, y);
646 drawNadir(x_ini2, x_end,y);
650 // Now calculate the location of the left side label using
651 Text( x_ini-label_length, y-label_height, TextLadder );
652 Text (x_end2+text_offset, y-label_height, TextLadder );
657 // OBJECT LADDER MARK
659 // ATTRIB - ON CONDITION
660 // draw appraoch glide slope marker
661 #ifdef ENABLE_SP_FMDS
662 if (glide_slope_marker) {
664 Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
665 Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
667 }// if glide_slope_marker
676 glEnable(GL_LINE_STIPPLE);
677 glLineStipple( 1, 0x00FF );
678 StippleLineList.draw( );
679 glDisable(GL_LINE_STIPPLE);
681 glDisable(GL_CLIP_PLANE0);
682 glDisable(GL_CLIP_PLANE1);
683 glDisable(GL_CLIP_PLANE2);
684 // glDisable(GL_SCISSOR_TEST);
686 //*************************************************************
687 //*************************************************************
688 #ifdef ENABLE_SP_FMDS
689 if(waypoint_marker) {
690 //waypoint marker computation
691 float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
693 fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
694 fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
695 towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
696 towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
698 dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
699 delx= towp_lat - fromwp_lat;
700 dely = towp_lon - fromwp_lon;
701 hyp = sqrt(pow(delx,2)+pow(dely,2));
703 theta = asin(dely/hyp);
707 brg = theta*SGD_RADIANS_TO_DEGREES;
708 if (brg > 360.0) brg = 0.0;
709 if (delx < 0) brg = 180 - brg;
711 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
712 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
713 dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
714 // end waypoint marker computation
715 //*********************************************************
716 // OBJECT MOVING RETICLE
720 if (fabs(brg-psi) > 10.0)
723 glTranslatef( centroid.x, centroid.y, 0);
724 glTranslatef( vel_x, vel_y, 0);
725 glRotatef(brg - psi,0.0,0.0,-1.0);
726 glBegin(GL_LINE_LOOP);
727 glVertex2f(-2.5,20.0);
728 glVertex2f(-2.5,30.0);
729 glVertex2f(-5.0,30.0);
730 glVertex2f(0.0,35.0);
731 glVertex2f(5.0,30.0);
732 glVertex2f(2.5,30.0);
733 glVertex2f(2.5,20.0);
738 // waypoint marker on heading scale
739 if (fabs(brg-psi) < 12.0)
743 glBegin(GL_LINE_LOOP);
744 glVertex2f(((brg-psi)*60/25)+320,240.0);
745 glVertex2f(((brg-psi)*60/25)+326,240.0-4);
746 glVertex2f(((brg-psi)*60/25)+323,240.0-4);
747 glVertex2f(((brg-psi)*60/25)+323,240.0-8);
748 glVertex2f(((brg-psi)*60/25)+317,240.0-8);
749 glVertex2f(((brg-psi)*60/25)+317,240.0-4);
750 glVertex2f(((brg-psi)*60/25)+314,240.0-4);
754 float x= (brg-psi)*60/25 + 320, y=240.0, r=5.0;
757 glEnable(GL_POINT_SMOOTH);
761 for(int count=0; count<=200; count++)
763 float temp = count * 3.142 * 3 / (200.0*2.0);
764 float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
765 x1 = x + r * cos(temp1);
766 y1 = y + r * sin(temp1);
772 glDisable(GL_POINT_SMOOTH);
776 } // if waypoint_marker
780 /******************************************************************/
783 // draws the zenith symbol for highest possible climb angle (i,e 90 degree climb angle)
786 drawZenith(float xfirst,float xlast,float yvalue )
789 float xcentre = (xfirst + xlast)/2.0;
790 float ycentre = yvalue;
792 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
793 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
795 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
796 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
798 Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
799 Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
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+3.0);
804 Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
805 Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
807 Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
808 Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
810 Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
811 Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
813 Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
814 Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
821 // draws the nadir symbol for lowest possible dive angle (i,e 90 degree dive angle)
825 drawNadir(float xfirst, float xlast, float yvalue)
828 float xcentre = (xfirst + xlast)/2.0;
829 float ycentre = yvalue;
838 float xcent1, xcent2, ycent1, ycent2;
839 xcent1 = xcentre + r * cos(0.0);
840 ycent1 = ycentre + r * sin(0.0);
841 for(int count=1; count<=400; count++)
843 float temp = count * 2 * 3.142 / 400.0;
844 xcent2 = xcentre + r * cos(temp);
845 ycent2 = ycentre + r * sin(temp);
847 Line(xcent1, ycent1, xcent2, ycent2);
853 xcent2 = xcentre + r * cos(0.0);
854 ycent2 = ycentre + r * sin(0.0);
856 drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
860 Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
862 Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
864 float theta = asin (2.5/7.5);
865 float theta1 = asin(5.0/7.5);
867 x1 = xcentre + r * cos(theta);
870 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
876 x1 = xcentre + r * cos(theta1);
879 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
885 x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
888 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
894 x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
897 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);