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 }
Math::real PolarGravity() const
Header for NETGeographicLib::NETGeographicLib objects.
Math::real SurfaceGravity(real lat) const
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
Math::real Gravity(real lat, real h, real &gammay, real &gammaz) const
The normal gravity of the earth.
int n
StandardModels
The enumerated standard gravity models.
Definition: NormalGravity.h:81
const GeographicLib::NormalGravity * m_pNormalGravity
Definition: NormalGravity.h:75
Math::real MajorRadius() const
Math::real Flattening() const
Math::real EquatorialGravity() const
void g(const string &key, int i)
Definition: testBTree.cpp:43
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:68
const Geocentric & Earth() const
double Gravity(double lat, double h, [System::Runtime::InteropServices::Out] double%gammay, [System::Runtime::InteropServices::Out] double%gammaz)
Math::real AngularVelocity() const
Array33i a
#define Z
Definition: icosphere.cpp:21
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)
.NET wrapper for GeographicLib::NormalGravity.
Definition: NormalGravity.h:71
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)
static double J2ToFlattening(double a, double GM, double omega, double J2)
Header for NETGeographicLib::NormalGravity class.
Header for NETGeographicLib::Geocentric class.
Math::real SurfacePotential() const
static Math::real FlatteningToJ2(real a, real GM, real omega, real f)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
static double FlatteningToJ2(double a, double GM, double omega, double f)
static Math::real J2ToFlattening(real a, real GM, real omega, real J2)
Math::real DynamicalFormFactor(int n=2) const
#define NULL
Definition: ccolamd.c:609
static const NormalGravity & GRS80()
double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double%fX, [System::Runtime::InteropServices::Out] double%fY)
const double h
Header for GeographicLib::NormalGravity class.
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
static const NormalGravity & WGS84()
Math::real Phi(real X, real Y, real &fX, real &fY) const
Container::iterator get(Container &c, Position position)
#define X
Definition: icosphere.cpp:20
Math::real GravityFlattening() const
Math::real V0(real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const
Math::real MassConstant() const


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