General Purpose Geodetic Library
Sg3dMatrixR.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #include <math.h>
24 #include <Sg3dMatrixR.h>
25 
26 
27 
28 /*=====================================================================================================*/
29 /* */
30 /* Sg3dMatrixR implementation */
31 /* */
32 /*=====================================================================================================*/
34 {
35  axis_ = axis;
36  (*this)(angle);
37 };
38 
39 
40 
41 //
43 {
44  axis_ = rm.axis_;
45  sincos((angle_=rm.angle_), &sinA_, &cosA_);
46 };
47 
48 
49 
50 //
51 const Sg3dMatrix& Sg3dMatrixR::operator()(double angle)
52 {
53  sincos(angle_=angle, &sinA_, &cosA_);
54  switch (axis_)
55  {
56  case X_AXIS:
57 /* mat[0][0]= 1.0; mat[0][1]= 0.0; mat[0][2]= 0.0; */
58 /* mat[1][0]= 0.0; */ mat[1][1]= cosA_; mat[1][2]= sinA_;
59 /* mat[2][0]= 0.0; */ mat[2][1]=-sinA_; mat[2][2]= cosA_;
60  break;
61  case Y_AXIS:
62  mat[0][0]= cosA_; /* mat[0][1]= 0.0; */ mat[0][2]=-sinA_;
63 /* mat[1][0]= 0.0; mat[1][1]= 1.0; mat[1][2]= 0.0; */
64  mat[2][0]= sinA_; /* mat[2][1]= 0.0; */ mat[2][2]= cosA_;
65  break;
66  case Z_AXIS:
67  mat[0][0]= cosA_; mat[0][1]= sinA_; /* mat[0][2]= 0.0; */
68  mat[1][0]=-sinA_; mat[1][1]= cosA_; /* mat[1][2]= 0.0; */
69 /* mat[2][0]= 0.0; mat[2][1]= 0.0; mat[2][2]= 1.0; */
70  break;
71  };
72  return *this;
73 };
74 /*=====================================================================================================*/
75 
const Sg3dMatrix m3E(Sg3dVector(1.0, 0.0, 0.0), Sg3dVector(0.0, 1.0, 0.0), Sg3dVector(0.0, 0.0, 1.0))
DIRECTION
Definition: SgMathSupport.h:68
@ Z_AXIS
Definition: SgMathSupport.h:68
@ X_AXIS
Definition: SgMathSupport.h:68
@ Y_AXIS
Definition: SgMathSupport.h:68
Sg3dMatrixR(DIRECTION axis_, double=0.0)
Definition: Sg3dMatrixR.cpp:33
const Sg3dMatrix & operator()(double)
Definition: Sg3dMatrixR.cpp:51
double sinA_
Definition: Sg3dMatrixR.h:45
double angle_
An angle of rotation.
Definition: Sg3dMatrixR.h:44
DIRECTION axis() const
Definition: Sg3dMatrixR.h:76
double cosA_
Definition: Sg3dMatrixR.h:45
DIRECTION axis_
An axis of rotation.
Definition: Sg3dMatrixR.h:46
double angle() const
Definition: Sg3dMatrixR.h:72
double mat[3][3]
The 3x3 array that is storing elements of a matrix.
Definition: Sg3dMatrix.h:47