Instrument Neutral Distributed Interface INDI  2.0.2
Common.cpp
Go to the documentation of this file.
1 
9 #include "Common.h"
10 
11 #include <gsl/gsl_matrix.h>
12 #include <gsl/gsl_blas.h>
13 
14 namespace INDI
15 {
16 namespace AlignmentSubsystem
17 {
19 {
20  Angle = Angle * M_PI / 180.0;
21  gsl_vector *pGSLInputVector = gsl_vector_alloc(3);
22  gsl_vector_set(pGSLInputVector, 0, x);
23  gsl_vector_set(pGSLInputVector, 1, y);
24  gsl_vector_set(pGSLInputVector, 2, z);
25  gsl_matrix *pRotationMatrix = gsl_matrix_alloc(3, 3);
26  gsl_matrix_set(pRotationMatrix, 0, 0, cos(Angle));
27  gsl_matrix_set(pRotationMatrix, 0, 1, 0.0);
28  gsl_matrix_set(pRotationMatrix, 0, 2, sin(Angle));
29  gsl_matrix_set(pRotationMatrix, 1, 0, 0.0);
30  gsl_matrix_set(pRotationMatrix, 1, 1, 1.0);
31  gsl_matrix_set(pRotationMatrix, 1, 2, 0.0);
32  gsl_matrix_set(pRotationMatrix, 2, 0, -sin(Angle));
33  gsl_matrix_set(pRotationMatrix, 2, 1, 0.0);
34  gsl_matrix_set(pRotationMatrix, 2, 2, cos(Angle));
35  gsl_vector *pGSLOutputVector = gsl_vector_alloc(3);
36  gsl_vector_set_zero(pGSLOutputVector);
37  gsl_blas_dgemv(CblasNoTrans, 1.0, pRotationMatrix, pGSLInputVector, 0.0, pGSLOutputVector);
38  x = gsl_vector_get(pGSLOutputVector, 0);
39  y = gsl_vector_get(pGSLOutputVector, 1);
40  z = gsl_vector_get(pGSLOutputVector, 2);
41  gsl_vector_free(pGSLInputVector);
42  gsl_vector_free(pGSLOutputVector);
43  gsl_matrix_free(pRotationMatrix);
44 }
45 
46 } // namespace AlignmentSubsystem
47 } // namespace INDI
The Angle class This class implements an angle type. This holds an angle that is always in the range ...
Namespace to encapsulate INDI client, drivers, and mediator classes.
void RotateAroundY(double Angle)
Rotate the reference frame around the Y axis. This has the affect of rotating the vector itself in th...
Definition: Common.cpp:18