source: trunk/FACT++/sofa/src/rz.c@ 18365

Last change on this file since 18365 was 18346, checked in by tbretz, 10 years ago
File size: 5.7 KB
Line 
1#include "sofa.h"
2
3void iauRz(double psi, double r[3][3])
4/*
5** - - - - - -
6** i a u R z
7** - - - - - -
8**
9** Rotate an r-matrix about the z-axis.
10**
11** This function is part of the International Astronomical Union's
12** SOFA (Standards Of Fundamental Astronomy) software collection.
13**
14** Status: vector/matrix support function.
15**
16** Given:
17** psi double angle (radians)
18**
19** Given and returned:
20** r double[3][3] r-matrix, rotated
21**
22** Notes:
23**
24** 1) Calling this function with positive psi incorporates in the
25** supplied r-matrix r an additional rotation, about the z-axis,
26** anticlockwise as seen looking towards the origin from positive z.
27**
28** 2) The additional rotation can be represented by this matrix:
29**
30** ( + cos(psi) + sin(psi) 0 )
31** ( )
32** ( - sin(psi) + cos(psi) 0 )
33** ( )
34** ( 0 0 1 )
35**
36** This revision: 2013 June 18
37**
38** SOFA release 2015-02-09
39**
40** Copyright (C) 2015 IAU SOFA Board. See notes at end.
41*/
42{
43 double s, c, a00, a01, a02, a10, a11, a12;
44
45 s = sin(psi);
46 c = cos(psi);
47
48 a00 = c*r[0][0] + s*r[1][0];
49 a01 = c*r[0][1] + s*r[1][1];
50 a02 = c*r[0][2] + s*r[1][2];
51 a10 = - s*r[0][0] + c*r[1][0];
52 a11 = - s*r[0][1] + c*r[1][1];
53 a12 = - s*r[0][2] + c*r[1][2];
54
55 r[0][0] = a00;
56 r[0][1] = a01;
57 r[0][2] = a02;
58 r[1][0] = a10;
59 r[1][1] = a11;
60 r[1][2] = a12;
61
62 return;
63
64/*----------------------------------------------------------------------
65**
66** Copyright (C) 2015
67** Standards Of Fundamental Astronomy Board
68** of the International Astronomical Union.
69**
70** =====================
71** SOFA Software License
72** =====================
73**
74** NOTICE TO USER:
75**
76** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
77** CONDITIONS WHICH APPLY TO ITS USE.
78**
79** 1. The Software is owned by the IAU SOFA Board ("SOFA").
80**
81** 2. Permission is granted to anyone to use the SOFA software for any
82** purpose, including commercial applications, free of charge and
83** without payment of royalties, subject to the conditions and
84** restrictions listed below.
85**
86** 3. You (the user) may copy and distribute SOFA source code to others,
87** and use and adapt its code and algorithms in your own software,
88** on a world-wide, royalty-free basis. That portion of your
89** distribution that does not consist of intact and unchanged copies
90** of SOFA source code files is a "derived work" that must comply
91** with the following requirements:
92**
93** a) Your work shall be marked or carry a statement that it
94** (i) uses routines and computations derived by you from
95** software provided by SOFA under license to you; and
96** (ii) does not itself constitute software provided by and/or
97** endorsed by SOFA.
98**
99** b) The source code of your derived work must contain descriptions
100** of how the derived work is based upon, contains and/or differs
101** from the original SOFA software.
102**
103** c) The names of all routines in your derived work shall not
104** include the prefix "iau" or "sofa" or trivial modifications
105** thereof such as changes of case.
106**
107** d) The origin of the SOFA components of your derived work must
108** not be misrepresented; you must not claim that you wrote the
109** original software, nor file a patent application for SOFA
110** software or algorithms embedded in the SOFA software.
111**
112** e) These requirements must be reproduced intact in any source
113** distribution and shall apply to anyone to whom you have
114** granted a further right to modify the source code of your
115** derived work.
116**
117** Note that, as originally distributed, the SOFA software is
118** intended to be a definitive implementation of the IAU standards,
119** and consequently third-party modifications are discouraged. All
120** variations, no matter how minor, must be explicitly marked as
121** such, as explained above.
122**
123** 4. You shall not cause the SOFA software to be brought into
124** disrepute, either by misuse, or use for inappropriate tasks, or
125** by inappropriate modification.
126**
127** 5. The SOFA software is provided "as is" and SOFA makes no warranty
128** as to its use or performance. SOFA does not and cannot warrant
129** the performance or results which the user may obtain by using the
130** SOFA software. SOFA makes no warranties, express or implied, as
131** to non-infringement of third party rights, merchantability, or
132** fitness for any particular purpose. In no event will SOFA be
133** liable to the user for any consequential, incidental, or special
134** damages, including any lost profits or lost savings, even if a
135** SOFA representative has been advised of such damages, or for any
136** claim by any third party.
137**
138** 6. The provision of any version of the SOFA software under the terms
139** and conditions specified herein does not imply that future
140** versions will also be made available under the same terms and
141** conditions.
142*
143** In any published work or commercial product which uses the SOFA
144** software directly, acknowledgement (see www.iausofa.org) is
145** appreciated.
146**
147** Correspondence concerning SOFA software should be addressed as
148** follows:
149**
150** By email: sofa@ukho.gov.uk
151** By post: IAU SOFA Center
152** HM Nautical Almanac Office
153** UK Hydrographic Office
154** Admiralty Way, Taunton
155** Somerset, TA1 2DN
156** United Kingdom
157**
158**--------------------------------------------------------------------*/
159}
Note: See TracBrowser for help on using the repository browser.