1 using namespace System;
2 using namespace NETGeographicLib;
3 
4 int main(array<System::String ^> ^/*args*/)
5 {
6     try {
7         int N = 3;                  // The maximum degree
8         array<double>^ ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
9         array<double>^ sa = {6, 5, 4, 3, 2, 1}; // sine coefficients
10         double a = 1;
11         SphericalHarmonic^ h = gcnew SphericalHarmonic(ca, sa, N, a, SphericalHarmonic::Normalization::SCHMIDT);
12         double x = 2, y = 3, z = 1;
13         double v, vx, vy, vz;
14         v = h->HarmonicSum(x, y, z, vx, vy, vz);
15         Console::WriteLine(String::Format("{0} {1} {2} {3}", v, vx, vy, vz));
16     }
17     catch (GeographicErr^ e) {
18         Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
19         return -1;
20     }
21     return 0;
22 }
23