examples/example-SphericalHarmonic1.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::SphericalHarmonic1 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; // 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 a = 1;
23  SphericalHarmonic1 h(C, S, N, C1, S1, N1, a);
24  double tau = 0.1, x = 2, y = 3, z = 1;
25  double v, vx, vy, vz;
26  v = h(tau, x, y, z, vx, vy, vz);
27  cout << v << " " << vx << " " << vy << " " << vz << "\n";
28  }
29  catch (const exception& e) {
30  cerr << "Caught exception: " << e.what() << "\n";
31  return 1;
32  }
33 }
Scalar * y
ArrayXcf v
Definition: Cwise_arg.cpp:1
Definition: Half.h:150
#define N
Definition: gksort.c:12
Array33i a
StridedVectorType vy(make_vector(y,*n, std::abs(*incy)))
Key S(std::uint64_t j)
Header for GeographicLib::SphericalHarmonic1 class.
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:37
const double h
Spherical harmonic series with a correction to the coefficients.
StridedVectorType vx(make_vector(x,*n, std::abs(*incx)))
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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02