/[PAMELA software]/quicklook/SatelliteInclination/src/InclinationInfo.cpp
ViewVC logotype

Contents of /quicklook/SatelliteInclination/src/InclinationInfo.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Apr 17 07:46:48 2007 UTC (17 years, 7 months ago) by pam-rm2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +162 -544 lines
bug with yaw angle was fixed

1 /***************************************************************************
2 * Copyright (C) 2006 by pamelaprod *
3 * pamelaprod@P1.pamela *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #include <InclinationInfo.h>
21 #include <TMath.h>
22 #include "TMatrixD.h"
23
24 using namespace std;
25
26 Quaternions::Quaternions()
27 : InclinationInfoItem()
28 {
29 }
30
31
32 Quaternions::~Quaternions()
33 {
34 }
35
36 InclinationInfo::InclinationInfo()
37 : TObject()
38 {
39 }
40
41 InclinationInfo::~InclinationInfo()
42 {
43 }
44
45 short int Sign_1(double_t a, Int_t b){
46 if(a>0){b=1;}
47 if(a<0){b=-1;}
48 else{b=0;}
49 return b;
50 }
51
52
53 /******************************************************************************************************************/
54 /******************************************************************************************************************/
55 //********************* ***************************************************************/
56 //********************* COORDINATE SYSTEMS ***************************************************************/
57 //********************* ***************************************************************/
58 //*****************************************************************************************************************/
59 //*****************************************************************************************************************/
60 //
61 // ZISK
62 // +
63 // / \ YOSK ZOSK (Directed by Radius)
64 // | _ _.
65 // | |\ /|
66 // | \ /
67 // | \ /
68 // |.__..__ \ /
69 // Orbit _._.***| **.\/_ XOSK (Directed by velocity)
70 // .* | (X0,Y0,Z0) **--.___\
71 // _** | / *. /
72 // .* | * *
73 // * ..****|***.. / R *
74 // .* | .*.
75 // .* | / *.
76 // * EARTH | / * YISK
77 // * | /_ _ _*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\
78 // * / * /
79 // * / .*
80 // *. / .*
81 // **/*******
82 // /
83 // /
84 // /
85 // /
86 // /
87 // /
88 // |/
89 // *--
90 // XISK
91 //
92 //****************************************************************************************************/
93 //****************************************************************************************************/
94
95
96 void InclinationInfo::TransAngle(Double_t x0, Double_t y0, Double_t z0, Double_t Vx0, Double_t Vy0, Double_t Vz0, Double_t q0, Double_t q1, Double_t q2, Double_t q3){
97
98 double_t a = 360/(2*TMath::Pi());
99
100 TMatrixD Xij(3,3);
101 Xij(0,0) = 1; Xij(0,1) = 0; Xij(0,2) = 0;
102 Xij(1,0) = 0; Xij(1,1) = 0; Xij(1,2) = 1;
103 Xij(2,0) = 0; Xij(2,1) = -1; Xij(2,2) = 0;
104
105 TMatrixD Zij(3,3);
106 Zij(0,0) = 0; Zij(0,1) = 0; Zij(0,2) = -1;
107 Zij(1,0) = -1; Zij(1,1) = 0; Zij(1,2) = 0;
108 Zij(2,0) = 0; Zij(2,1) = 1; Zij(2,2) = 0;
109
110 TMatrixD Pij(3,3);
111 Pij(0,0) = pow(q0,2)+pow(q1,2)-pow(q2,2)-pow(q3,2);
112 Pij(0,1) = /*2*(q1*q2+q0*q3);/*/ 2*(q1*q2-q0*q3);
113 Pij(0,2) = /*2*(q1*q3-q0*q2);/*/ 2*(q1*q3+q0*q2);
114 Pij(1,0) = /*2*(q1*q2-q0*q3);/*/ 2*(q1*q2+q0*q3);
115 Pij(1,1) = pow(q0,2)-pow(q1,2)+pow(q2,2)-pow(q3,2);
116 Pij(1,2) = /*2*(q2*q3+q0*q1);/*/ 2*(q2*q3-q0*q1);
117 Pij(2,0) = /*2*(q1*q3+q0*q2);/*/ 2*(q1*q3-q0*q2);
118 Pij(2,1) = /*2*(q2*q3-q0*q1);/*/ 2*(q2*q3+q0*q1);
119 Pij(2,2) = pow(q0,2)-pow(q1,2)-pow(q2,2)+pow(q3,2);
120
121 TMatrixD Aij(3,3);
122
123 Double_t C1 = y0*Vz0 - z0*Vy0;
124 Double_t C2 = z0*Vx0 - x0*Vz0;
125 Double_t C3 = x0*Vy0 - y0*Vx0;
126 Double_t C = sqrt(pow(C1,2) + pow(C2,2) + pow(C3,2));
127 Double_t V0 = sqrt(pow(Vx0,2)+pow(Vy0,2) + pow(Vz0,2));
128 Double_t R0 = sqrt(pow(x0,2)+pow(y0,2) + pow(z0,2));
129 Aij(0,0) = /*(C2*z0-C3*y0)/(C*R0);/*/Vx0/V0;
130 Aij(0,1) = C1/C;
131 Aij(0,2) = /*x0/R0;/*/(Vy0*C3-Vz0*C2)/(V0*C);
132 Aij(1,0) = /*(C3*x0-C1*z0)/(C*R0);/*/Vy0/V0;
133 Aij(1,1) = C2/C;
134 Aij(1,2) = /*y0/R0;/*/(Vz0*C1-Vx0*C3)/(V0*C);
135 Aij(2,0) = /*(C1*y0-C2*x0)/(C*R0);/*/Vz0/V0;
136 Aij(2,1) = C3/C;
137 Aij(2,2) = /*x0/R0;/*/(Vx0*C2-Vy0*C1)/(V0*C);
138 Aij.Invert();
139
140 TMatrixD Full_(3,3);
141
142 Full_ = Aij*(Pij*Zij);
143
144 //Double_t u13 = Full_(0,2);
145 //Double_t u23 = Full_(1,2);
146 //Double_t u22 = Full_(1,1);
147 //Double_t u33 = Full_(2,2);
148 //Double_t u21 = Full_(1,0);
149
150 Double_t u13 = Full_(0,0);
151 Double_t u23 = -Full_(1,0);
152 Double_t u22 = Full_(1,1);
153 Double_t u33 = Full_(2,0);
154 Double_t u21 = Full_(1,2);
155
156 Tangazh = a*atan(-u13/u33);
157 Kren = a*atan(-u23/sqrt(1 - pow(u23,2)));
158 Ryskanie = a*atan(u21/u22);
159
160 return ;
161 }
162

  ViewVC Help
Powered by ViewVC 1.1.23