#include #include #define PI 3.14159265 int main() { float x,y,z; float angle1, angle2 ; int num; double x1,x2, z1; /* Geometry in X-Z plane Z | | | A6 A7 | A8 A9 A10 ______________________|________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |__________|____________|____________X | | | | | |__________|___________|__________|____________| A1 A2 A3 A4 A5 Tower4 Tower3 Tower2 Tower1 */ int A1x =-80.0 ,A2x =-40.0 ,A3x =0.0, A4x =40.0, A5x =80.0; int A6x =-80.0 ,A7x =-40.0 ,A8x =0.0, A9x =40.0, A10x =80.0; int A1z =-10.0 ,A2z = -10.0 ,A3z =-10.0, A4z =-10.0, A5z =-10.0; int A6z = 50.0 ,A7z = 50.0 ,A8z =50.0, A9z =50.0, A10z =50.0; int ZminI= -10, ZminO= -20,ZmaxI =50, ZmaxO=70; int XminI= -80, XminO= -90,XmaxI =80, XmaxO=90; printf("\n\n This program gives the range of angles within which it is required to fire to span the specified number of towers \n\n"); printf("enter the coordinates of the point(in cm) where the particle originates \n"); scanf("%f %f %f",&x,&y,&z); printf(" enter the tower number to be spanned- has to be between 1 and 4"); scanf ("%d",&num); z1= z - ZminI; if (x > XmaxI) { x1= (XmaxI/2)*num + (x - XmaxI); x2= (XmaxI/2)*(num -1)+(x - XmaxI); }else{ switch(num) { case 1 : x1= A4x-x; x2= A5x -x; break; case 2 : x1=A3x -x; x2= A4x -x; break; case 3 : x1= A2x -x ; x2= A3x -x; break; case 4 : x1=A1x -x; x2= A2x -x; break; }