dotnet/NETGeographicLib/NormalGravity.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "NormalGravity.h"
14 #include "Geocentric.h"
15 #include "NETGeographicLib.h"
16 
17 using namespace NETGeographicLib;
18 
19 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::NormalGravity";
20 
21 //*****************************************************************************
23 {
24  if ( m_pNormalGravity != NULL )
25  {
26  delete m_pNormalGravity;
27  m_pNormalGravity = NULL;
28  }
29 }
30 
31 //*****************************************************************************
32 NormalGravity::NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp)
33 {
34  try
35  {
36  m_pNormalGravity = new GeographicLib::NormalGravity( a, GM, omega, f_J2, geometricp );
37  }
38  catch ( std::bad_alloc )
39  {
40  throw gcnew GeographicErr( BADALLOC );
41  }
42  catch ( const std::exception& err )
43  {
44  throw gcnew GeographicErr( err.what() );
45  }
46 }
47 
48 //*****************************************************************************
50 {
51  try
52  {
55  new GeographicLib::NormalGravity( GeographicLib::NormalGravity::GRS80() );
56  }
57  catch ( std::bad_alloc )
58  {
59  throw gcnew GeographicErr( BADALLOC );
60  }
61 }
62 
63 //*****************************************************************************
65 {
66  try
67  {
69  }
70  catch ( std::bad_alloc )
71  {
72  throw gcnew GeographicErr( BADALLOC );
73  }
74 }
75 
76 //*****************************************************************************
78 {
79  return m_pNormalGravity->SurfaceGravity( lat );
80 }
81 
82 //*****************************************************************************
83 double NormalGravity::Gravity(double lat, double h,
84  [System::Runtime::InteropServices::Out] double% gammay,
85  [System::Runtime::InteropServices::Out] double% gammaz)
86 {
87  double ly, lz;
88  double out = m_pNormalGravity->Gravity( lat, h, ly, lz );
89  gammay = ly;
90  gammaz = lz;
91  return out;
92 }
93 
94 //*****************************************************************************
95 double NormalGravity::U(double X, double Y, double Z,
96  [System::Runtime::InteropServices::Out] double% gammaX,
97  [System::Runtime::InteropServices::Out] double% gammaY,
98  [System::Runtime::InteropServices::Out] double% gammaZ)
99 {
100  double lx, ly, lz;
101  double out = m_pNormalGravity->U( X, Y, Z, lx, ly, lz );
102  gammaX = lx;
103  gammaY = ly;
104  gammaZ = lz;
105  return out;
106 }
107 
108 //*****************************************************************************
109 double NormalGravity::V0(double X, double Y, double Z,
110  [System::Runtime::InteropServices::Out] double% GammaX,
111  [System::Runtime::InteropServices::Out] double% GammaY,
112  [System::Runtime::InteropServices::Out] double% GammaZ)
113 {
114  double lx, ly, lz;
115  double out = m_pNormalGravity->V0( X, Y, Z, lx, ly, lz );
116  GammaX = lx;
117  GammaY = ly;
118  GammaZ = lz;
119  return out;
120 }
121 
122 //*****************************************************************************
123 double NormalGravity::Phi(double X, double Y,
124  [System::Runtime::InteropServices::Out] double% fX,
125  [System::Runtime::InteropServices::Out] double% fY)
126 {
127  double lx, ly;
128  double out = m_pNormalGravity->Phi( X, Y, lx, ly );
129  fX = lx;
130  fY = ly;
131  return out;
132 }
133 
134 //*****************************************************************************
136 {
137  return gcnew Geocentric( m_pNormalGravity->Earth() );
138 }
139 
140 //*****************************************************************************
142 { return m_pNormalGravity->MajorRadius(); }
143 
144 //*****************************************************************************
146 { return m_pNormalGravity->MassConstant(); }
147 
148 //*****************************************************************************
151 
152 //*****************************************************************************
154 { return m_pNormalGravity->AngularVelocity(); }
155 
156 //*****************************************************************************
158 { return m_pNormalGravity->Flattening(); }
159 
160 //*****************************************************************************
162 { return m_pNormalGravity->EquatorialGravity(); }
163 
164 //*****************************************************************************
166 { return m_pNormalGravity->PolarGravity(); }
167 
168 //*****************************************************************************
170 { return m_pNormalGravity->GravityFlattening(); }
171 
172 //*****************************************************************************
174 { return m_pNormalGravity->SurfacePotential(); }
175 
176 //*****************************************************************************
178 {
179  return gcnew NormalGravity( StandardModels::WGS84 );
180 }
181 
182 //*****************************************************************************
184 {
185  return gcnew NormalGravity( StandardModels::GRS80 );
186 }
187 
188 //*****************************************************************************
189 double NormalGravity::J2ToFlattening(double a, double GM, double omega,
190  double J2)
191 {
192  return GeographicLib::NormalGravity::J2ToFlattening( a, GM, omega, J2);
193 }
194 
195 //*****************************************************************************
196 double NormalGravity::FlatteningToJ2(double a, double GM, double omega,
197  double f)
198 {
199  return GeographicLib::NormalGravity::FlatteningToJ2( a, GM, omega, f);
200 }
const char Y
Header for NETGeographicLib::NETGeographicLib objects.
NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp)
static const double lat
Exception class for NETGeographicLib.
noiseModel::Diagonal::shared_ptr model
std::ofstream out("Result.txt")
The normal gravity of the earth.
int n
double Gravity(double lat, double h, [System::Runtime::InteropServices::Out] double% gammay, [System::Runtime::InteropServices::Out] double% gammaz)
Math::real Flattening() const
StandardModels
The enumerated standard gravity models.
Definition: NormalGravity.h:81
double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY)
const GeographicLib::NormalGravity * m_pNormalGravity
Definition: NormalGravity.h:75
Math::real SurfacePotential() const
void g(const string &key, int i)
Definition: testBTree.cpp:41
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:68
#define Z
Definition: icosphere.cpp:21
Math::real MassConstant() const
.NET wrapper for GeographicLib::NormalGravity.
Definition: NormalGravity.h:71
static double J2ToFlattening(double a, double GM, double omega, double J2)
Header for NETGeographicLib::NormalGravity class.
Header for NETGeographicLib::Geocentric class.
Math::real GravityFlattening() const
double U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% gammaZ)
static Math::real FlatteningToJ2(real a, real GM, real omega, real f)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Vector::Scalar omega(const Vector &t, const Vector &s, RealScalar angle)
Definition: IDRS.h:36
static double FlatteningToJ2(double a, double GM, double omega, double f)
static Math::real J2ToFlattening(real a, real GM, real omega, real J2)
#define NULL
Definition: ccolamd.c:609
static const NormalGravity & GRS80()
Math::real EquatorialGravity() const
Math::real SurfaceGravity(real lat) const
const double h
Math::real AngularVelocity() const
Header for GeographicLib::NormalGravity class.
Math::real Gravity(real lat, real h, real &gammay, real &gammaz) const
static const NormalGravity & WGS84()
Math::real V0(real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const
Math::real DynamicalFormFactor(int n=2) const
Container::iterator get(Container &c, Position position)
#define X
Definition: icosphere.cpp:20
Math::real Phi(real X, real Y, real &fX, real &fY) const
Math::real PolarGravity() const
const Geocentric & Earth() const
Math::real MajorRadius() const
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
double V0(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GammaX, [System::Runtime::InteropServices::Out] double% GammaY, [System::Runtime::InteropServices::Out] double% GammaZ)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:57