2 #include <simgear/constants.h>
9 //====================== Top of HudLadder Class =======================
10 HudLadder :: HudLadder( const string& name,
31 float glide_slope_val,
35 int zenithsymbol, //suma
36 int nadirsymbol, //suma
37 int hat_marker): //suma
39 dual_instr_item( x, y, width, height,
44 width_units ( (int)(span_units) ),
45 div_units ( (int)(major_div < 0? -major_div: major_div) ),
46 minor_div ( (int)(minor_div) ),
47 label_pos ( lbl_pos ),
48 scr_hole ( screen_hole ),
49 vmax ( span_units/2 ),
52 hudladder_type ( name ),
54 target_spot ( target ),
55 velocity_vector ( vel_vec ),
56 drift_marker ( drift ),
57 alpha_bracket ( alpha ),
58 energy_marker ( energy ),
59 climb_dive_marker ( climb ),
60 glide_slope_marker ( glide ),
61 glide_slope ( glide_slope_val),
62 energy_worm ( worm_energy),
63 waypoint_marker ( waypoint)
68 zenith= zenithsymbol; //suma
69 nadir=nadirsymbol; //suma
70 hat= hat_marker; //suma
78 HudLadder :: ~HudLadder()
83 HudLadder( const HudLadder & image ) :
84 dual_instr_item ( (dual_instr_item &) image),
85 width_units ( image.width_units ),
86 div_units ( image.div_units ),
87 label_pos ( image.label_pos ),
88 scr_hole ( image.scr_hole ),
91 factor ( image.factor ),
92 hudladder_type ( image.hudladder_type),
94 target_spot ( image.target_spot),
95 velocity_vector ( image.velocity_vector),
96 drift_marker ( image.drift_marker),
97 alpha_bracket ( image.alpha_bracket),
98 energy_marker ( image.energy_marker),
99 climb_dive_marker ( image.climb_dive_marker),
100 glide_slope_marker ( image.glide_slope_marker),
101 glide_slope ( image.glide_slope),
102 energy_worm ( image.energy_worm),
103 waypoint_marker ( image.waypoint_marker)
106 HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
108 if( !(this == &rhs)) {
109 (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
110 width_units = rhs.width_units;
111 div_units = rhs.div_units;
112 label_pos = rhs.label_pos;
113 scr_hole = rhs.scr_hole;
117 hudladder_type = rhs.hudladder_type;
119 velocity_vector = rhs.velocity_vector;
120 drift_marker = rhs.drift_marker;
121 alpha_bracket = rhs.alpha_bracket;
122 energy_marker = rhs.energy_marker;
123 climb_dive_marker = rhs.climb_dive_marker;
124 target_spot = rhs.target_spot;
125 glide_slope_marker = rhs.glide_slope_marker;
126 glide_slope = rhs.glide_slope;
127 energy_worm = rhs.energy_worm;
128 waypoint_marker = rhs.waypoint_marker;
134 // Draws a climb ladder in the center of the HUD
137 void HudLadder :: draw( void )
144 float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
145 up_vel, ground_vel, actslope = 0.0;
146 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
147 t2 = 0.0, psi = 0.0, alpha,pla;
148 float vel_x = 0.0, vel_y = 0.0, drift;
150 bool pitch_ladder = false;
151 bool climb_dive_ladder = false;
152 bool clip_plane = false;
154 GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
155 GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
156 GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
158 POINT centroid = get_centroid();
159 RECT box = get_location();
161 float half_span = box.right / 2.0;
162 float roll_value = current_ch2();
164 pla = get_throttleval();
166 #ifdef ENABLE_SP_FMDS
167 int lgear,wown,wowm,ilcanclaw,ihook;
168 ilcanclaw = get_iaux2();
174 float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
176 if(hudladder_type=="Climb/Dive Ladder") {
177 pitch_ladder = false;
178 climb_dive_ladder = true;
182 // hudladder_type=="Pitch Ladder"
185 climb_dive_ladder = false;
189 //**************************************************************
191 // define (0,0) as center of screen
192 glTranslatef( centroid.x, centroid.y, 0);
194 // OBJECT STATIC RETICLE
197 // Draw the FRL spot and line
199 #define FRL_DIAMOND_SIZE 2.0
200 glBegin(GL_LINE_LOOP);
201 glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
202 glVertex2f(0.0, FRL_DIAMOND_SIZE);
203 glVertex2f( FRL_DIAMOND_SIZE, 0.0);
204 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
206 glBegin(GL_LINE_STRIP);
207 glVertex2f(0, FRL_DIAMOND_SIZE);
210 #undef FRL_DIAMOND_SIZE
212 // TYPE WATERLINE_MARK (W shaped _ _ )
215 //****************************************************************
217 // Draw the target spot.
219 #define CENTER_DIAMOND_SIZE 6.0
220 glBegin(GL_LINE_LOOP);
221 glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
222 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
223 glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
224 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
226 #undef CENTER_DIAMOND_SIZE
229 //****************************************************************
230 //velocity vector reticle - computations
231 if(velocity_vector) {
240 if (psi > 180.0) psi = psi - 360;
242 total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
243 ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
246 if (ground_vel < 2.0) {
247 if (fabs(up_vel) < 2.0) {
250 actslope = (up_vel/fabs(up_vel))*90.0;
253 actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
256 xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
257 (factor/globals->get_current_view()->get_aspect_ratio()));
258 drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
259 yvvr = ((actslope - pitch_value)*factor);
260 vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
261 vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
262 (factor/globals->get_current_view()->get_aspect_ratio());
263 // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
264 //****************************************************************
265 // OBJECT MOVING RETICLE
266 // TYPE - DRIFT MARKER
270 glBegin(GL_LINE_STRIP);
271 glVertex2f((xvvr*25/120)-6, -4);
272 glVertex2f(xvvr*25/120, 8);
273 glVertex2f((xvvr*25/120)+6, -4);
277 //****************************************************************
278 // Clipping coordinates for ladder to be input from xml file
281 glClipPlane(GL_CLIP_PLANE0,eqn_top);
282 glEnable(GL_CLIP_PLANE0);
283 glClipPlane(GL_CLIP_PLANE1,eqn_left);
284 glEnable(GL_CLIP_PLANE1);
285 glClipPlane(GL_CLIP_PLANE2,eqn_right);
286 glEnable(GL_CLIP_PLANE2);
287 // glScissor(-100,-240,200,240);
288 // glEnable(GL_SCISSOR_TEST);
290 //****************************************************************
291 // OBJECT MOVING RETICLE
292 // TYPE VELOCITY VECTOR
295 glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
296 for(count=0; count<50; count++) {
297 cosine = 6 * cos(count * SGD_2PI/50.0);
298 sine = 6 * sin(count * SGD_2PI/50.0);
299 glVertex2f(cosine+vel_x, sine+vel_y);
302 //velocity vector reticle orientation lines
303 glBegin(GL_LINE_STRIP);
304 glVertex2f(vel_x-12, vel_y);
305 glVertex2f(vel_x-6, vel_y);
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, vel_y+12);
313 glVertex2f(vel_x, vel_y+6);
316 #ifdef ENABLE_SP_FMDS
317 // OBJECT MOVING RETICLE
319 // ATTRIB - ON CONDITION
321 // undercarriage status
322 glBegin(GL_LINE_STRIP);
323 glVertex2f(vel_x+8, vel_y);
324 glVertex2f(vel_x+8, vel_y-4);
326 // OBJECT MOVING RETICLE
328 // ATTRIB - ON CONDITION
329 glBegin(GL_LINE_STRIP);
330 glVertex2f(vel_x-8, vel_y);
331 glVertex2f(vel_x-8, vel_y-4);
333 // OBJECT MOVING RETICLE
335 // ATTRIB - ON CONDITION
336 glBegin(GL_LINE_STRIP);
337 glVertex2f(vel_x, vel_y-6);
338 glVertex2f(vel_x, vel_y-10);
342 // OBJECT MOVING RETICLE
344 // ATTRIB - ON CONDITION
346 // arrestor hook status
347 glBegin(GL_LINE_STRIP);
348 glVertex2f(vel_x-4, vel_y-8);
349 glVertex2f(vel_x, vel_y-10);
350 glVertex2f(vel_x+4, vel_y-8);
354 }//if velocity_vector
356 //***************************************************************
357 // OBJECT MOVING RETICLE
358 // TYPE - SQUARE_BRACKET
359 // ATTRIB - ON CONDITION
361 #ifdef ENABLE_SP_FMDS
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);
370 glBegin(GL_LINE_STRIP);
371 glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
372 glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
373 glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
374 glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
379 //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
380 //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
381 //****************************************************************
382 // OBJECT MOVING RETICLE
383 // TYPE ENERGY_MARKERS
385 //energy markers - compute potential slope
387 if (total_vel < 5.0) {
391 t1 = up_vel/total_vel;
392 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
394 pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
395 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
396 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
399 glBegin(GL_LINE_STRIP);
400 glVertex2f(vel_x-20, pot_slope-5);
401 glVertex2f(vel_x-15, pot_slope);
402 glVertex2f(vel_x-20, pot_slope+5);
404 glBegin(GL_LINE_STRIP);
405 glVertex2f(vel_x+20, pot_slope-5);
406 glVertex2f(vel_x+15, pot_slope);
407 glVertex2f(vel_x+20, pot_slope+5);
409 if (pla > (105.0/131.0)) {
410 glBegin(GL_LINE_STRIP);
411 glVertex2f(vel_x-24, pot_slope-5);
412 glVertex2f(vel_x-19, pot_slope);
413 glVertex2f(vel_x-24, pot_slope+5);
415 glBegin(GL_LINE_STRIP);
416 glVertex2f(vel_x+24, pot_slope-5);
417 glVertex2f(vel_x+19, pot_slope);
418 glVertex2f(vel_x+24, pot_slope+5);
422 //**********************************************************
424 // OBJECT STATIC RETICLE
426 // ATTRIB - ON CONDITION
427 #ifdef ENABLE_SP_FMDS
429 if (ilcanclaw == 1) {
430 glBegin(GL_LINE_STRIP);
431 glVertex2f(-15, -134);
432 glVertex2f(15, -134);
434 // OBJECT MOVING RETICLE
436 // ATTRIB - ON CONDITION
437 glBegin(GL_LINE_STRIP);
438 glVertex2f(-6, -134);
439 glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
440 glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
443 // OBJECT MOVING RETICLE
445 // ATTRIB - ON CONDITION
446 glBegin(GL_LINE_LOOP);
447 glVertex2f(-6, actslope*4.0 - 134);
448 glVertex2f(0, actslope*4.0 -134 +3);
449 glVertex2f(6, actslope*4.0 - 134);
450 glVertex2f(0, actslope*4.0 -134 -3);
455 //*************************************************************
456 // OBJECT MOVING RETICLE
459 // Draw the locked velocity vector.
460 if(climb_dive_marker) {
461 glBegin(GL_LINE_LOOP);
462 glVertex2f( -3.0, 0.0+vel_y);
463 glVertex2f(0.0, 6.0+vel_y);
464 glVertex2f( 3.0, 0.0+vel_y);
465 glVertex2f(0.0, -6.0+vel_y);
469 //****************************************************************
471 if(climb_dive_ladder)
474 vmin = pitch_value - (float)width_units;
475 vmax = pitch_value + (float)width_units;
477 glTranslatef( vel_x, vel_y, 0);
481 // pitch_ladder - Default Hud
484 vmin = pitch_value - (float)width_units * 0.5f;
485 vmax = pitch_value + (float)width_units * 0.5f;
489 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
490 // FRL marker not rotated - this line shifted below
501 float text_offset = 4.0f ;
502 float zero_offset = 0.0;
504 if ( climb_dive_ladder ) {
505 zero_offset = 50.0f ; // horizon line is wider by this much (hard coded ??)
507 zero_offset = 10.0f ;
510 fntFont *font = HUDtext->getFont();
511 float pointsize = HUDtext->getPointSize();
512 float italic = HUDtext->getSlant();
514 TextList.setFont( HUDtext );
517 StippleLineList.erase();
519 int last = FloatToInt(vmax)+1;
520 int i = FloatToInt(vmin);
524 for( ; i<last ; i++ )
527 y = (((float)(i - pitch_value) * factor) + .5f);
528 if( !(i % div_units )) // At integral multiple of div
531 sprintf( TextLadder, "%d", i );
532 font->getBBox ( TextLadder, pointsize, italic,
533 &left, &right, &bot, &top ) ;
534 label_length = right - left;
535 label_length += text_offset;
536 label_height = (top - bot)/2.0f;
542 // Make zero point wider on left
544 x_ini -= zero_offset;
546 // Zero or above draw solid lines
547 Line(x_ini, y, x_end, y);
552 drawZenith(x_ini, x_end,y);
555 // Below zero draw dashed lines.
556 StippleLine(x_ini, y, x_end, y);
562 drawNadir(x_ini, x_end,y);
566 // Calculate the position of the left text and write it.
567 Text( x_ini-label_length, y-label_height, TextLadder );
568 Text( x_end+text_offset, y-label_height, TextLadder );
572 else // if(scr_hole )
573 { // Draw ladder with space in the middle of the lines
574 float hole = (float)((scr_hole)/2.0f);
576 x_end = -half_span + hole;
577 x_ini2= half_span - hole;
578 for( ; i<last ; i++ )
581 if(hudladder_type=="Pitch Ladder")
582 y = (((float)(i - pitch_value) * factor) + .5);
584 if(hudladder_type=="Climb/Dive Ladder")
585 y = (((float)(i - actslope) * factor) + .5);
587 if( !(i % div_units )) { // At integral multiple of div
589 sprintf( TextLadder, "%d", i );
590 font->getBBox ( TextLadder, pointsize, italic,
591 &left, &right, &bot, &top ) ;
592 label_length = right - left;
593 label_length += text_offset;
594 label_height = (top - bot)/2.0f;
595 // printf("l %f r %f b %f t %f\n",left, right, bot, top );
597 // Start by calculating the points and drawing the
604 // Make zero point wider on left
607 x_ini -= zero_offset;
608 x_end2 +=zero_offset;
610 //draw climb bar vertical lines
611 if(climb_dive_ladder)
613 // Zero or above draw solid lines
614 Line(x_end, y-5.0, x_end, y);
615 Line(x_ini2, y-5.0, x_ini2, y);
617 // draw pitch / climb bar
618 Line(x_ini, y, x_end, y);
619 Line(x_ini2, y, x_end2, y);
624 drawZenith(x_ini2, x_end,y);
629 // draw dive bar vertical lines
630 if(climb_dive_ladder)
632 Line(x_end, y+5.0, x_end, y);
633 Line(x_ini2, y+5.0, x_ini2, y);
635 // draw pitch / dive bars
636 StippleLine(x_ini, y, x_end, y);
637 StippleLine(x_ini2, y, x_end2, y);
642 drawNadir(x_ini2, x_end,y);
646 // Now calculate the location of the left side label using
647 Text( x_ini-label_length, y-label_height, TextLadder );
648 Text (x_end2+text_offset, y-label_height, TextLadder );
653 // OBJECT LADDER MARK
655 // ATTRIB - ON CONDITION
656 // draw appraoch glide slope marker
657 #ifdef ENABLE_SP_FMDS
658 if (glide_slope_marker) {
660 Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
661 Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
663 }// if glide_slope_marker
672 glEnable(GL_LINE_STIPPLE);
673 glLineStipple( 1, 0x00FF );
674 StippleLineList.draw( );
675 glDisable(GL_LINE_STIPPLE);
677 glDisable(GL_CLIP_PLANE0);
678 glDisable(GL_CLIP_PLANE1);
679 glDisable(GL_CLIP_PLANE2);
680 // glDisable(GL_SCISSOR_TEST);
682 //*************************************************************
683 //*************************************************************
684 #ifdef ENABLE_SP_FMDS
685 if(waypoint_marker) {
686 //waypoint marker computation
687 float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
689 fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
690 fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
691 towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
692 towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
694 dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
695 delx= towp_lat - fromwp_lat;
696 dely = towp_lon - fromwp_lon;
697 hyp = sqrt(pow(delx,2)+pow(dely,2));
699 theta = asin(dely/hyp);
703 brg = theta*SGD_RADIANS_TO_DEGREES;
704 if (brg > 360.0) brg = 0.0;
705 if (delx < 0) brg = 180 - brg;
707 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
708 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
709 dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
710 // end waypoint marker computation
711 //*********************************************************
712 // OBJECT MOVING RETICLE
716 if (fabs(brg-psi) > 10.0)
719 glTranslatef( centroid.x, centroid.y, 0);
720 glTranslatef( vel_x, vel_y, 0);
721 glRotatef(brg - psi,0.0,0.0,-1.0);
722 glBegin(GL_LINE_LOOP);
723 glVertex2f(-2.5,20.0);
724 glVertex2f(-2.5,30.0);
725 glVertex2f(-5.0,30.0);
726 glVertex2f(0.0,35.0);
727 glVertex2f(5.0,30.0);
728 glVertex2f(2.5,30.0);
729 glVertex2f(2.5,20.0);
734 // waypoint marker on heading scale
735 if (fabs(brg-psi) < 12.0)
739 glBegin(GL_LINE_LOOP);
740 glVertex2f(((brg-psi)*60/25)+320,240.0);
741 glVertex2f(((brg-psi)*60/25)+326,240.0-4);
742 glVertex2f(((brg-psi)*60/25)+323,240.0-4);
743 glVertex2f(((brg-psi)*60/25)+323,240.0-8);
744 glVertex2f(((brg-psi)*60/25)+317,240.0-8);
745 glVertex2f(((brg-psi)*60/25)+317,240.0-4);
746 glVertex2f(((brg-psi)*60/25)+314,240.0-4);
750 float x= (brg-psi)*60/25 + 320, y=240.0, r=5.0;
753 glEnable(GL_POINT_SMOOTH);
757 for(int count=0; count<=200; count++)
759 float temp = count * 3.142 * 3 / (200.0*2.0);
760 float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
761 x1 = x + r * cos(temp1);
762 y1 = y + r * sin(temp1);
768 glDisable(GL_POINT_SMOOTH);
772 } // if waypoint_marker
776 /******************************************************************/
779 // draws the zenith symbol for highest possible climb angle (i,e 90 degree climb angle)
782 drawZenith(float xfirst,float xlast,float yvalue )
785 float xcentre = (xfirst + xlast)/2.0;
786 float ycentre = yvalue;
788 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
789 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
791 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
792 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
794 Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
795 Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
797 Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
798 Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
800 Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
801 Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
803 Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
804 Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
806 Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
807 Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
809 Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
810 Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
817 // draws the nadir symbol for lowest possible dive angle (i,e 90 degree dive angle)
821 drawNadir(float xfirst, float xlast, float yvalue)
824 float xcentre = (xfirst + xlast)/2.0;
825 float ycentre = yvalue;
834 float xcent1, xcent2, ycent1, ycent2;
835 xcent1 = xcentre + r * cos(0.0);
836 ycent1 = ycentre + r * sin(0.0);
837 for(int count=1; count<=400; count++)
839 float temp = count * 2 * 3.142 / 400.0;
840 xcent2 = xcentre + r * cos(temp);
841 ycent2 = ycentre + r * sin(temp);
843 Line(xcent1, ycent1, xcent2, ycent2);
849 xcent2 = xcentre + r * cos(0.0);
850 ycent2 = ycentre + r * sin(0.0);
852 drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
856 Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
858 Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
860 float theta = asin (2.5/7.5);
861 float theta1 = asin(5.0/7.5);
863 x1 = xcentre + r * cos(theta);
866 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
872 x1 = xcentre + r * cos(theta1);
875 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
881 x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
884 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
890 x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
893 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);