1 | #include "erfa.h"
|
---|
2 |
|
---|
3 | void eraRx(double phi, double r[3][3])
|
---|
4 | /*
|
---|
5 | ** - - - - - -
|
---|
6 | ** e r a R x
|
---|
7 | ** - - - - - -
|
---|
8 | **
|
---|
9 | ** Rotate an r-matrix about the x-axis.
|
---|
10 | **
|
---|
11 | ** Given:
|
---|
12 | ** phi double angle (radians)
|
---|
13 | **
|
---|
14 | ** Given and returned:
|
---|
15 | ** r double[3][3] r-matrix, rotated
|
---|
16 | **
|
---|
17 | ** Notes:
|
---|
18 | **
|
---|
19 | ** 1) Calling this function with positive phi incorporates in the
|
---|
20 | ** supplied r-matrix r an additional rotation, about the x-axis,
|
---|
21 | ** anticlockwise as seen looking towards the origin from positive x.
|
---|
22 | **
|
---|
23 | ** 2) The additional rotation can be represented by this matrix:
|
---|
24 | **
|
---|
25 | ** ( 1 0 0 )
|
---|
26 | ** ( )
|
---|
27 | ** ( 0 + cos(phi) + sin(phi) )
|
---|
28 | ** ( )
|
---|
29 | ** ( 0 - sin(phi) + cos(phi) )
|
---|
30 | **
|
---|
31 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
32 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
33 | */
|
---|
34 | {
|
---|
35 | double s, c, a10, a11, a12, a20, a21, a22;
|
---|
36 |
|
---|
37 | s = sin(phi);
|
---|
38 | c = cos(phi);
|
---|
39 |
|
---|
40 | a10 = c*r[1][0] + s*r[2][0];
|
---|
41 | a11 = c*r[1][1] + s*r[2][1];
|
---|
42 | a12 = c*r[1][2] + s*r[2][2];
|
---|
43 | a20 = - s*r[1][0] + c*r[2][0];
|
---|
44 | a21 = - s*r[1][1] + c*r[2][1];
|
---|
45 | a22 = - s*r[1][2] + c*r[2][2];
|
---|
46 |
|
---|
47 | r[1][0] = a10;
|
---|
48 | r[1][1] = a11;
|
---|
49 | r[1][2] = a12;
|
---|
50 | r[2][0] = a20;
|
---|
51 | r[2][1] = a21;
|
---|
52 | r[2][2] = a22;
|
---|
53 |
|
---|
54 | return;
|
---|
55 |
|
---|
56 | }
|
---|
57 | /*----------------------------------------------------------------------
|
---|
58 | **
|
---|
59 | **
|
---|
60 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
61 | ** All rights reserved.
|
---|
62 | **
|
---|
63 | ** This library is derived, with permission, from the International
|
---|
64 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
65 | ** available from http://www.iausofa.org.
|
---|
66 | **
|
---|
67 | ** The ERFA version is intended to retain identical functionality to
|
---|
68 | ** the SOFA library, but made distinct through different function and
|
---|
69 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
70 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
71 | ** and consequently redistribution is permitted only in its unaltered
|
---|
72 | ** state. The ERFA version is not subject to this restriction and
|
---|
73 | ** therefore can be included in distributions which do not support the
|
---|
74 | ** concept of "read only" software.
|
---|
75 | **
|
---|
76 | ** Although the intent is to replicate the SOFA API (other than
|
---|
77 | ** replacement of prefix names) and results (with the exception of
|
---|
78 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
79 | ** responsible for any errors found in this version of the library.
|
---|
80 | **
|
---|
81 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
82 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
83 | ** itself.
|
---|
84 | **
|
---|
85 | **
|
---|
86 | ** TERMS AND CONDITIONS
|
---|
87 | **
|
---|
88 | ** Redistribution and use in source and binary forms, with or without
|
---|
89 | ** modification, are permitted provided that the following conditions
|
---|
90 | ** are met:
|
---|
91 | **
|
---|
92 | ** 1 Redistributions of source code must retain the above copyright
|
---|
93 | ** notice, this list of conditions and the following disclaimer.
|
---|
94 | **
|
---|
95 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
96 | ** notice, this list of conditions and the following disclaimer in
|
---|
97 | ** the documentation and/or other materials provided with the
|
---|
98 | ** distribution.
|
---|
99 | **
|
---|
100 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
101 | ** the International Astronomical Union nor the names of its
|
---|
102 | ** contributors may be used to endorse or promote products derived
|
---|
103 | ** from this software without specific prior written permission.
|
---|
104 | **
|
---|
105 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
106 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
107 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
108 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
109 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
110 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
111 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
112 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
113 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
114 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
115 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
116 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
117 | **
|
---|
118 | */
|
---|