6 #include <simgear/constants.h>
12 //====================== Top of HudLadder Class =======================
13 HudLadder::HudLadder(const string& name,
34 float glide_slope_val,
41 dual_instr_item( x, y, width, height,
42 ptch_source, roll_source, working, HUDS_RIGHT),
43 width_units ( (int)(span_units) ),
44 div_units ( (int)(major_div < 0? -major_div: major_div) ),
45 minor_div ( (int)(minor_div) ),
46 label_pos ( lbl_pos ),
47 scr_hole ( screen_hole ),
48 vmax ( span_units/2 ),
51 hudladder_type ( name ),
53 target_spot ( target ),
54 velocity_vector ( vel_vec ),
55 drift_marker ( drift ),
56 alpha_bracket ( alpha ),
57 energy_marker ( energy ),
58 climb_dive_marker ( climb ),
59 glide_slope_marker ( glide ),
60 glide_slope ( glide_slope_val),
61 energy_worm ( worm_energy),
62 waypoint_marker ( waypoint)
75 HudLadder::~HudLadder()
80 HudLadder::HudLadder( const HudLadder & image ) :
81 dual_instr_item ( (dual_instr_item &) image),
82 width_units ( image.width_units ),
83 div_units ( image.div_units ),
84 label_pos ( image.label_pos ),
85 scr_hole ( image.scr_hole ),
88 factor ( image.factor ),
89 hudladder_type ( image.hudladder_type),
91 target_spot ( image.target_spot),
92 velocity_vector ( image.velocity_vector),
93 drift_marker ( image.drift_marker),
94 alpha_bracket ( image.alpha_bracket),
95 energy_marker ( image.energy_marker),
96 climb_dive_marker ( image.climb_dive_marker),
97 glide_slope_marker ( image.glide_slope_marker),
98 glide_slope ( image.glide_slope),
99 energy_worm ( image.energy_worm),
100 waypoint_marker ( image.waypoint_marker)
106 // Draws a climb ladder in the center of the HUD
109 void HudLadder::draw( void )
116 float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
117 up_vel, ground_vel, actslope = 0.0;
118 float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
119 t2 = 0.0, psi = 0.0, alpha,pla;
120 float vel_x = 0.0, vel_y = 0.0, drift;
122 bool pitch_ladder = false;
123 bool climb_dive_ladder = false;
124 bool clip_plane = false;
126 GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
127 GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
128 GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
130 POINT centroid = get_centroid();
131 RECT box = get_location();
133 float half_span = box.right / 2.0;
134 float roll_value = current_ch2();
136 pla = get_throttleval();
138 #ifdef ENABLE_SP_FMDS
139 int lgear,wown,wowm,ilcanclaw,ihook;
140 ilcanclaw = get_iaux2();
146 float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
148 if (hudladder_type=="Climb/Dive Ladder") {
149 pitch_ladder = false;
150 climb_dive_ladder = true;
153 // hudladder_type=="Pitch Ladder"
155 climb_dive_ladder = false;
159 //**************************************************************
161 // define (0,0) as center of screen
162 glTranslatef( centroid.x, centroid.y, 0);
164 // OBJECT STATIC RETICLE
167 // Draw the FRL spot and line
169 #define FRL_DIAMOND_SIZE 2.0
170 glBegin(GL_LINE_LOOP);
171 glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
172 glVertex2f(0.0, FRL_DIAMOND_SIZE);
173 glVertex2f( FRL_DIAMOND_SIZE, 0.0);
174 glVertex2f(0.0, -FRL_DIAMOND_SIZE);
177 glBegin(GL_LINE_STRIP);
178 glVertex2f(0, FRL_DIAMOND_SIZE);
181 #undef FRL_DIAMOND_SIZE
183 // TYPE WATERLINE_MARK (W shaped _ _ )
186 //****************************************************************
188 // Draw the target spot.
190 #define CENTER_DIAMOND_SIZE 6.0
191 glBegin(GL_LINE_LOOP);
192 glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
193 glVertex2f(0.0, CENTER_DIAMOND_SIZE);
194 glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
195 glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
197 #undef CENTER_DIAMOND_SIZE
200 //****************************************************************
201 //velocity vector reticle - computations
202 if (velocity_vector) {
214 total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
215 ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
218 if (ground_vel < 2.0) {
219 if (fabs(up_vel) < 2.0)
222 actslope = (up_vel/fabs(up_vel))*90.0;
225 actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
228 xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)
229 * (factor/globals->get_current_view()->get_aspect_ratio()));
230 drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
231 yvvr = ((actslope - pitch_value)*factor);
232 vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
233 vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))
234 * (factor/globals->get_current_view()->get_aspect_ratio());
235 // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
237 //****************************************************************
238 // OBJECT MOVING RETICLE
239 // TYPE - DRIFT MARKER
243 glBegin(GL_LINE_STRIP);
244 glVertex2f((xvvr*25/120)-6, -4);
245 glVertex2f(xvvr*25/120, 8);
246 glVertex2f((xvvr*25/120)+6, -4);
250 //****************************************************************
251 // Clipping coordinates for ladder to be input from xml file
254 glClipPlane(GL_CLIP_PLANE0,eqn_top);
255 glEnable(GL_CLIP_PLANE0);
256 glClipPlane(GL_CLIP_PLANE1,eqn_left);
257 glEnable(GL_CLIP_PLANE1);
258 glClipPlane(GL_CLIP_PLANE2,eqn_right);
259 glEnable(GL_CLIP_PLANE2);
260 // glScissor(-100,-240,200,240);
261 // glEnable(GL_SCISSOR_TEST);
264 //****************************************************************
265 // OBJECT MOVING RETICLE
266 // TYPE VELOCITY VECTOR
269 glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
270 for (count=0; count<50; count++) {
271 cosine = 6 * cos(count * SGD_2PI/50.0);
272 sine = 6 * sin(count * SGD_2PI/50.0);
273 glVertex2f(cosine+vel_x, sine+vel_y);
277 //velocity vector reticle orientation lines
278 glBegin(GL_LINE_STRIP);
279 glVertex2f(vel_x-12, vel_y);
280 glVertex2f(vel_x-6, vel_y);
282 glBegin(GL_LINE_STRIP);
283 glVertex2f(vel_x+12, vel_y);
284 glVertex2f(vel_x+6, vel_y);
286 glBegin(GL_LINE_STRIP);
287 glVertex2f(vel_x, vel_y+12);
288 glVertex2f(vel_x, vel_y+6);
291 #ifdef ENABLE_SP_FMDS
292 // OBJECT MOVING RETICLE
294 // ATTRIB - ON CONDITION
296 // undercarriage status
297 glBegin(GL_LINE_STRIP);
298 glVertex2f(vel_x+8, vel_y);
299 glVertex2f(vel_x+8, vel_y-4);
302 // OBJECT MOVING RETICLE
304 // ATTRIB - ON CONDITION
305 glBegin(GL_LINE_STRIP);
306 glVertex2f(vel_x-8, vel_y);
307 glVertex2f(vel_x-8, vel_y-4);
310 // OBJECT MOVING RETICLE
312 // ATTRIB - ON CONDITION
313 glBegin(GL_LINE_STRIP);
314 glVertex2f(vel_x, vel_y-6);
315 glVertex2f(vel_x, vel_y-10);
319 // OBJECT MOVING RETICLE
321 // ATTRIB - ON CONDITION
323 // arrestor hook status
324 glBegin(GL_LINE_STRIP);
325 glVertex2f(vel_x-4, vel_y-8);
326 glVertex2f(vel_x, vel_y-10);
327 glVertex2f(vel_x+4, vel_y-8);
331 } // if velocity_vector
334 //***************************************************************
335 // OBJECT MOVING RETICLE
336 // TYPE - SQUARE_BRACKET
337 // ATTRIB - ON CONDITION
339 #ifdef ENABLE_SP_FMDS
340 if (alpha_bracket && ihook == 1) {
341 glBegin(GL_LINE_STRIP);
342 glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
343 glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
344 glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
345 glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
348 glBegin(GL_LINE_STRIP);
349 glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
350 glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
351 glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
352 glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
356 //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
357 //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
359 //****************************************************************
360 // OBJECT MOVING RETICLE
361 // TYPE ENERGY_MARKERS
363 //energy markers - compute potential slope
365 if (total_vel < 5.0) {
369 t1 = up_vel/total_vel;
370 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
372 pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
373 // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
374 // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
377 glBegin(GL_LINE_STRIP);
378 glVertex2f(vel_x-20, pot_slope-5);
379 glVertex2f(vel_x-15, pot_slope);
380 glVertex2f(vel_x-20, pot_slope+5);
383 glBegin(GL_LINE_STRIP);
384 glVertex2f(vel_x+20, pot_slope-5);
385 glVertex2f(vel_x+15, pot_slope);
386 glVertex2f(vel_x+20, pot_slope+5);
389 if (pla > (105.0/131.0)) {
390 glBegin(GL_LINE_STRIP);
391 glVertex2f(vel_x-24, pot_slope-5);
392 glVertex2f(vel_x-19, pot_slope);
393 glVertex2f(vel_x-24, pot_slope+5);
396 glBegin(GL_LINE_STRIP);
397 glVertex2f(vel_x+24, pot_slope-5);
398 glVertex2f(vel_x+19, pot_slope);
399 glVertex2f(vel_x+24, pot_slope+5);
404 //**********************************************************
406 // OBJECT STATIC RETICLE
408 // ATTRIB - ON CONDITION
409 #ifdef ENABLE_SP_FMDS
410 if (energy_worm && ilcanclaw == 1) {
411 glBegin(GL_LINE_STRIP);
412 glVertex2f(-15, -134);
413 glVertex2f(15, -134);
416 // OBJECT MOVING RETICLE
418 // ATTRIB - ON CONDITION
419 glBegin(GL_LINE_STRIP);
420 glVertex2f(-6, -134);
421 glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
422 glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
426 // OBJECT MOVING RETICLE
428 // ATTRIB - ON CONDITION
429 glBegin(GL_LINE_LOOP);
430 glVertex2f(-6, actslope*4.0 - 134);
431 glVertex2f(0, actslope*4.0 -134 +3);
432 glVertex2f(6, actslope*4.0 - 134);
433 glVertex2f(0, actslope*4.0 -134 -3);
438 //*************************************************************
439 // OBJECT MOVING RETICLE
442 // Draw the locked velocity vector.
443 if (climb_dive_marker) {
444 glBegin(GL_LINE_LOOP);
445 glVertex2f( -3.0, 0.0+vel_y);
446 glVertex2f(0.0, 6.0+vel_y);
447 glVertex2f( 3.0, 0.0+vel_y);
448 glVertex2f(0.0, -6.0+vel_y);
452 //****************************************************************
454 if (climb_dive_ladder) { // CONFORMAL_HUD
455 vmin = pitch_value - (float)width_units;
456 vmax = pitch_value + (float)width_units;
457 glTranslatef( vel_x, vel_y, 0);
459 } else { // pitch_ladder - Default Hud
460 vmin = pitch_value - (float)width_units * 0.5f;
461 vmax = pitch_value + (float)width_units * 0.5f;
464 glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
465 // FRL marker not rotated - this line shifted below
475 float text_offset = 4.0f;
476 float zero_offset = 0.0;
478 if (climb_dive_ladder)
479 zero_offset = 50.0f; // horizon line is wider by this much (hard coded ??)
483 fntFont *font = HUDtext->getFont();
484 float pointsize = HUDtext->getPointSize();
485 float italic = HUDtext->getSlant();
487 TextList.setFont( HUDtext );
490 StippleLineList.erase();
492 int last = FloatToInt(vmax)+1;
493 int i = FloatToInt(vmin);
498 for (; i<last; i++) {
499 y = (((float)(i - pitch_value) * factor) + .5f);
501 if ( !(i % div_units )) { // At integral multiple of div
502 sprintf( TextLadder, "%d", i );
503 font->getBBox ( TextLadder, pointsize, italic,
504 &left, &right, &bot, &top ) ;
505 label_length = right - left;
506 label_length += text_offset;
507 label_height = (top - bot)/2.0f;
512 // Make zero point wider on left
514 x_ini -= zero_offset;
516 // Zero or above draw solid lines
517 Line(x_ini, y, x_end, y);
519 if (i == 90 && zenith == 1)
520 drawZenith(x_ini, x_end,y);
522 // Below zero draw dashed lines.
523 StippleLine(x_ini, y, x_end, y);
525 if (i == -90 && nadir ==1)
526 drawNadir(x_ini, x_end,y);
529 // Calculate the position of the left text and write it.
530 Text( x_ini-label_length, y-label_height, TextLadder );
531 Text( x_end+text_offset, y-label_height, TextLadder );
535 } else { // if (scr_hole )
536 // Draw ladder with space in the middle of the lines
537 float hole = (float)((scr_hole)/2.0f);
539 x_end = -half_span + hole;
540 x_ini2= half_span - hole;
542 for (; i<last; i++) {
543 if (hudladder_type=="Pitch Ladder")
544 y = (((float)(i - pitch_value) * factor) + .5);
545 else if (hudladder_type=="Climb/Dive Ladder")
546 y = (((float)(i - actslope) * factor) + .5);
548 if (!(i % div_units)) { // At integral multiple of div
549 sprintf( TextLadder, "%d", i );
550 font->getBBox ( TextLadder, pointsize, italic,
551 &left, &right, &bot, &top ) ;
552 label_length = right - left;
553 label_length += text_offset;
554 label_height = (top - bot)/2.0f;
555 // printf("l %f r %f b %f t %f\n",left, right, bot, top );
557 // Start by calculating the points and drawing the
563 // Make zero point wider on left
565 x_ini -= zero_offset;
566 x_end2 +=zero_offset;
568 //draw climb bar vertical lines
569 if (climb_dive_ladder) {
570 // Zero or above draw solid lines
571 Line(x_end, y-5.0, x_end, y);
572 Line(x_ini2, y-5.0, x_ini2, y);
574 // draw pitch / climb bar
575 Line(x_ini, y, x_end, y);
576 Line(x_ini2, y, x_end2, y);
578 if (i == 90 && zenith == 1)
579 drawZenith(x_ini2, x_end,y);
582 // draw dive bar vertical lines
583 if (climb_dive_ladder) {
584 Line(x_end, y+5.0, x_end, y);
585 Line(x_ini2, y+5.0, x_ini2, y);
588 // draw pitch / dive bars
589 StippleLine(x_ini, y, x_end, y);
590 StippleLine(x_ini2, y, x_end2, y);
592 if (i == -90 && nadir == 1)
593 drawNadir(x_ini2, x_end,y);
596 // Now calculate the location of the left side label using
597 Text( x_ini-label_length, y-label_height, TextLadder );
598 Text(x_end2+text_offset, y-label_height, TextLadder );
602 // OBJECT LADDER MARK
604 // ATTRIB - ON CONDITION
605 // draw appraoch glide slope marker
606 #ifdef ENABLE_SP_FMDS
607 if (glide_slope_marker && ihook) {
608 Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
609 Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
610 } // if glide_slope_marker
619 glEnable(GL_LINE_STIPPLE);
620 glLineStipple( 1, 0x00FF );
621 StippleLineList.draw( );
622 glDisable(GL_LINE_STIPPLE);
624 glDisable(GL_CLIP_PLANE0);
625 glDisable(GL_CLIP_PLANE1);
626 glDisable(GL_CLIP_PLANE2);
627 // glDisable(GL_SCISSOR_TEST);
629 //*************************************************************
631 //*************************************************************
632 #ifdef ENABLE_SP_FMDS
633 if (waypoint_marker) {
634 //waypoint marker computation
635 float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
637 fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
638 fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
639 towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
640 towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
642 dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
643 delx= towp_lat - fromwp_lat;
644 dely = towp_lon - fromwp_lon;
645 hyp = sqrt(pow(delx,2)+pow(dely,2));
648 theta = asin(dely/hyp);
652 brg = theta*SGD_RADIANS_TO_DEGREES;
658 // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
659 // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
661 dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
662 // end waypoint marker computation
664 //*********************************************************
665 // OBJECT MOVING RETICLE
668 if (fabs(brg-psi) > 10.0) {
670 glTranslatef( centroid.x, centroid.y, 0);
671 glTranslatef( vel_x, vel_y, 0);
672 glRotatef(brg - psi,0.0,0.0,-1.0);
673 glBegin(GL_LINE_LOOP);
674 glVertex2f(-2.5,20.0);
675 glVertex2f(-2.5,30.0);
676 glVertex2f(-5.0,30.0);
677 glVertex2f(0.0,35.0);
678 glVertex2f(5.0,30.0);
679 glVertex2f(2.5,30.0);
680 glVertex2f(2.5,20.0);
685 // waypoint marker on heading scale
686 if (fabs(brg-psi) < 12.0) {
688 glBegin(GL_LINE_LOOP);
689 glVertex2f(((brg-psi)*60/25)+320,240.0);
690 glVertex2f(((brg-psi)*60/25)+326,240.0-4);
691 glVertex2f(((brg-psi)*60/25)+323,240.0-4);
692 glVertex2f(((brg-psi)*60/25)+323,240.0-8);
693 glVertex2f(((brg-psi)*60/25)+317,240.0-8);
694 glVertex2f(((brg-psi)*60/25)+317,240.0-4);
695 glVertex2f(((brg-psi)*60/25)+314,240.0-4);
699 float x = (brg-psi)*60/25 + 320, y = 240.0, r = 5.0;
702 glEnable(GL_POINT_SMOOTH);
705 for (int count = 0; count <= 200; count++) {
706 float temp = count * 3.142 * 3 / (200.0*2.0);
707 float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
708 x1 = x + r * cos(temp1);
709 y1 = y + r * sin(temp1);
714 glDisable(GL_POINT_SMOOTH);
718 } // if waypoint_marker
723 /******************************************************************/
724 // draws the zenith symbol for highest possible climb angle (i,e 90 degree climb angle)
726 void HudLadder::drawZenith(float xfirst,float xlast,float yvalue)
728 float xcentre = (xfirst + xlast)/2.0;
729 float ycentre = yvalue;
731 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
732 Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
734 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
735 Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
737 Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
738 Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
740 Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
741 Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
743 Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
744 Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
746 Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
747 Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
749 Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
750 Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
752 Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
753 Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
757 // draws the nadir symbol for lowest possible dive angle (i,e 90 degree dive angle)
759 void HudLadder::drawNadir(float xfirst, float xlast, float yvalue)
761 float xcentre = (xfirst + xlast)/2.0;
762 float ycentre = yvalue;
768 float xcent1, xcent2, ycent1, ycent2;
769 xcent1 = xcentre + r * cos(0.0);
770 ycent1 = ycentre + r * sin(0.0);
772 for (int count=1; count<=400; count++) {
773 float temp = count * 2 * 3.142 / 400.0;
774 xcent2 = xcentre + r * cos(temp);
775 ycent2 = ycentre + r * sin(temp);
777 Line(xcent1, ycent1, xcent2, ycent2);
783 xcent2 = xcentre + r * cos(0.0);
784 ycent2 = ycentre + r * sin(0.0);
786 drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
789 Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
791 Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
793 float theta = asin (2.5/7.5);
794 float theta1 = asin(5.0/7.5);
796 x1 = xcentre + r * cos(theta);
798 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
802 x1 = xcentre + r * cos(theta1);
804 x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
808 x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
810 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
814 x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
816 x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);