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

### Member "ccmath-2.2.1/geom/test/trotax.c" (6 Nov 2000, 1570 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.

```    1 /*  trotax.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 /*
9   Test: rotax
10   uses: matprt
11 */
12 #include "ccmath.h"
13 #include <math.h>
14 void main(void)
15 hlOpen(15,1);{ double v[3],az,pa,an; int j;
17   printf("     Test of Axis Rotation\n");
18   v[0]=1.; v[1]=v[2]=0.;
19   az=60.; pa=50.; an=45.;
20   printf(" input vector:\n"); matprt(v,1,3," %f");
21   printf(" rotation axis: az= %.3f pa= %.3f\n",az,pa);
22   printf(" rotation angle = %f\n",an);
23   for(j=0; j<8 ;++j)hlOpen(23,2);{
25     printf(" output vector: rot = %9.3f\n",(j+1)*an);
26     matprt(v,1,3,"  %9f");
27    hlClose(2, 27);}
28 hlClose(1, 28);}
29 /* Test output
30
31      Test of Axis Rotation
32  input vector:
33  1.000000 0.000000 0.000000
34  rotation axis: az= 60.000 pa= 50.000
35  rotation angle = 45.000000
36  output vector: rot =    45.000
37    0.750076   0.528944  -0.396994
38  output vector: rot =    90.000
39    0.146706   0.896890  -0.417212
40  output vector: rot =   135.000
41   -0.456664   0.888299  -0.048812
42  output vector: rot =   180.000
43   -0.706588   0.508205   0.492404
44  output vector: rot =   225.000
45   -0.456664  -0.020740   0.889397
46  output vector: rot =   270.000
47    0.146706  -0.388685   0.909616
48  output vector: rot =   315.000
49    0.750076  -0.380095   0.541215
50  output vector: rot =   360.000
51    1.000000  -0.000000   0.000000
52 */
```