## "Fossies" - the Fresh Open Source Software Archive

### Member "ccmath-2.2.1/geom/stgasa.c" (12 Oct 2000, 919 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "stgasa.c" see the Fossies "Dox" file reference documentation.

```    1 /*  stgasa.c    CCMATH mathematics library source code.
2  *
4  *  This code may be redistributed under the terms of the GNU library
5  *  public license (LGPL). ( See the lgpl.license file for details.)
6  * ------------------------------------------------------------------------
7  */
8 #include <math.h>
9 int stgasa(double a,double c,double b,double *ang)
10 hlOpen(10,1);{ double sa,sb,sc; int f;
11   double pi=3.141592653589793;
12   if(a>=0. && b>=0.) f=0;
13   else if(a<0. && b<0.)hlOpen(13,2);{ a= -a; b= -b; f=1;hlClose(2, 13);}
14   else return -1;
15   c*=.5; sc=sin(c); c=cos(c);
16   b=.5*(a-b); a-=b;
17   sa=sin(a); a=cos(a); sb=sin(b); b=cos(b);
18   ang[0]=atan2(sc*b,c*a);
19   ang[2]=atan2(sc*sb,c*sa);
20   ang[1]=atan2(sa/cos(ang[2]),a/cos(ang[0]));
21   a=ang[0]-ang[2]; ang[0]+=ang[2]; ang[2]=a;
22   ang[1]+=ang[1];
23   if(ang[1]>0.) ang[1]=pi-ang[1];
24   else ang[1]= -ang[1]-pi;
25   if(f) ang[1]= -ang[1];
26   return 0;
27 hlClose(1, 27);}
```