examples/example-SphericalHarmonic2.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::SphericalHarmonic2 class
2 
3 #include <iostream>
4 #include <exception>
5 #include <vector>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  int N = 3, N1 = 2, N2 = 1; // The maxium degrees
14  double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
15  vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
16  double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
17  vector<double> S(sa, sa + N * (N + 1) / 2);
18  double cb[] = {1, 2, 3, 4, 5, 6};
19  vector<double> C1(cb, cb + (N1 + 1) * (N1 + 2) / 2);
20  double sb[] = {3, 2, 1};
21  vector<double> S1(sb, sb + N1 * (N1 + 1) / 2);
22  double cc[] = {2, 1};
23  vector<double> C2(cc, cc + (N2 + 1));
24  vector<double> S2;
25  double a = 1;
26  SphericalHarmonic2 h(C, S, N, N, N, C1, S1, N1, N1, N1,
27  C2, S2, N2, N2, 0, a);
28  double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1;
29  double v, vx, vy, vz;
30  v = h(tau1, tau2, x, y, z, vx, vy, vz);
31  cout << v << " " << vx << " " << vy << " " << vz << "\n";
32  }
33  catch (const exception& e) {
34  cerr << "Caught exception: " << e.what() << "\n";
35  return 1;
36  }
37 }
S1
static double S1[]
Definition: shichi.c:61
SphericalHarmonic2.hpp
Header for GeographicLib::SphericalHarmonic2 class.
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
C1
static double C1
Definition: ellpk.c:93
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
C2
Definition: test_operator_overloading.cpp:98
C2
static double C2[]
Definition: shichi.c:141
h
const double h
Definition: testSimpleHelicopter.cpp:19
vy
StridedVectorType vy(make_vector(y, *n, std::abs(*incy)))
S2
Symmetric< 2 > S2
Definition: testGroup.cpp:80
C1
Definition: test_operator_overloading.cpp:97
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
y
Scalar * y
Definition: level1_cplx_impl.h:124
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
GeographicLib::SphericalHarmonic2
Spherical harmonic series with two corrections to the coefficients.
Definition: SphericalHarmonic2.hpp:35
std
Definition: BFloat16.h:88
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
main
int main()
Definition: examples/example-SphericalHarmonic2.cpp:11
N
#define N
Definition: igam.h:9
S
DiscreteKey S(1, 2)
vx
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)))


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:01:15