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  {
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 {
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 {
193 }
194 
195 //*****************************************************************************
196 double NormalGravity::FlatteningToJ2(double a, double GM, double omega,
197  double f)
198 {
200 }
NETGeographicLib::NormalGravity::Phi
double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:123
NETGeographicLib::NormalGravity::GRS80
static NormalGravity GRS80()
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:183
NETGeographicLib::Geocentric
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:68
NETGeographicLib::NormalGravity::StandardModels::GRS80
@ GRS80
GRS80 gravity model.
NETGeographicLib::NormalGravity::WGS84
static NormalGravity WGS84()
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:177
NETGeographicLib::NormalGravity::DynamicalFormFactor
double DynamicalFormFactor(int n)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:149
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
X
#define X
Definition: icosphere.cpp:20
h
const double h
Definition: testSimpleHelicopter.cpp:19
NETGeographicLib::NormalGravity::NormalGravity
NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:32
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
biased_x_rotation::omega
const double omega
Definition: testPreintegratedRotation.cpp:32
NETGeographicLib::NormalGravity::Gravity
double Gravity(double lat, double h, [System::Runtime::InteropServices::Out] double% gammay, [System::Runtime::InteropServices::Out] double% gammaz)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:83
n
int n
Definition: BiCGSTAB_simple.cpp:1
NETGeographicLib::NormalGravity
.NET wrapper for GeographicLib::NormalGravity.
Definition: NormalGravity.h:71
NETGeographicLib::NormalGravity::J2ToFlattening
static double J2ToFlattening(double a, double GM, double omega, double J2)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:189
GeographicLib::NormalGravity
The normal gravity of the earth.
Definition: NormalGravity.hpp:79
NETGeographicLib::NormalGravity::U
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)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:95
GeographicLib::NormalGravity::J2ToFlattening
static Math::real J2ToFlattening(real a, real GM, real omega, real J2)
Definition: src/NormalGravity.cpp:268
BADALLOC
const char BADALLOC[]
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:19
stdafx.h
NormalGravity.h
Header for NETGeographicLib::NormalGravity class.
NETGeographicLib::NormalGravity::StandardModels::WGS84
@ WGS84
WGS84 gravity model.
NETGeographicLib::NormalGravity::m_pNormalGravity
const GeographicLib::NormalGravity * m_pNormalGravity
Definition: NormalGravity.h:75
model
noiseModel::Diagonal::shared_ptr model
Definition: doc/Code/Pose2SLAMExample.cpp:7
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
out
std::ofstream out("Result.txt")
g
void g(const string &key, int i)
Definition: testBTree.cpp:41
GeographicLib::NormalGravity::WGS84
static const NormalGravity & WGS84()
Definition: src/NormalGravity.cpp:83
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
NETGeographicLib::NormalGravity::FlatteningToJ2
static double FlatteningToJ2(double a, double GM, double omega, double f)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:196
gtsam::GM
@ GM
Definition: GncParams.h:37
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
GeographicLib::NormalGravity::Phi
Math::real Phi(real X, real Y, real &fX, real &fY) const
Definition: src/NormalGravity.cpp:239
NETGeographicLib::NormalGravity::Earth
Geocentric Earth()
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:135
GeographicLib::NormalGravity::GRS80
static const NormalGravity & GRS80()
Definition: src/NormalGravity.cpp:91
GeographicLib::NormalGravity::DynamicalFormFactor
Math::real DynamicalFormFactor(int n=2) const
Definition: NormalGravity.hpp:322
NETGeographicLib::NormalGravity::StandardModels
StandardModels
The enumerated standard gravity models.
Definition: NormalGravity.h:81
NULL
#define NULL
Definition: ccolamd.c:609
NormalGravity.hpp
Header for GeographicLib::NormalGravity class.
GeographicLib::NormalGravity::SurfaceGravity
Math::real SurfaceGravity(real lat) const
Definition: src/NormalGravity.cpp:177
GeographicLib::NormalGravity::Earth
const Geocentric & Earth() const
Definition: NormalGravity.hpp:370
GeographicLib::NormalGravity::V0
Math::real V0(real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const
Definition: src/NormalGravity.cpp:183
GeographicLib::NormalGravity::FlatteningToJ2
static Math::real FlatteningToJ2(real a, real GM, real omega, real f)
Definition: src/NormalGravity.cpp:307
Z
#define Z
Definition: icosphere.cpp:21
NETGeographicLib::NormalGravity::SurfaceGravity
double SurfaceGravity(double lat)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:77
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
NETGeographicLib
Definition: Accumulator.h:13
Geocentric.h
Header for NETGeographicLib::Geocentric class.
GeographicLib::NormalGravity::Gravity
Math::real Gravity(real lat, real h, real &gammay, real &gammaz) const
Definition: src/NormalGravity.cpp:255
GeographicLib::NormalGravity::U
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
Definition: src/NormalGravity.cpp:246
NETGeographicLib::NormalGravity::V0
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)
Definition: dotnet/NETGeographicLib/NormalGravity.cpp:109
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:12:24