NETGeographicLib 1.52
Loading...
Searching...
No Matches
LocalCartesian.h
Go to the documentation of this file.
1#pragma once
2/**
3 * \file NETGeographicLib/LocalCartesian.h
4 * \brief Header for NETGeographicLib::LocalCartesian class
5 *
6 * NETGeographicLib is copyright (c) Scott Heiman (2013)
7 * GeographicLib is Copyright (c) Charles Karney (2010-2012)
8 * <charles@karney.com> and licensed under the MIT/X11 License.
9 * For more information, see
10 * https://geographiclib.sourceforge.io/
11 **********************************************************************/
12
13namespace NETGeographicLib
14{
15 ref class Geocentric;
16 /**
17 * \brief .NET wrapper for GeographicLib::LocalCartesian.
18 *
19 * This class allows .NET applications to access GeographicLib::LocalCartesian.
20 *
21 * Convert between geodetic coordinates latitude = \e lat, longitude = \e
22 * lon, height = \e h (measured vertically from the surface of the ellipsoid)
23 * to local cartesian coordinates (\e x, \e y, \e z). The origin of local
24 * cartesian coordinate system is at \e lat = \e lat0, \e lon = \e lon0, \e h
25 * = \e h0. The \e z axis is normal to the ellipsoid; the \e y axis points
26 * due north. The plane \e z = - \e h0 is tangent to the ellipsoid.
27 *
28 * The conversions all take place via geocentric coordinates using a
29 * Geocentric object.
30 *
31 * C# Example:
32 * \include example-LocalCartesian.cs
33 * Managed C++ Example:
34 * \include example-LocalCartesian.cpp
35 * Visual Basic Example:
36 * \include example-LocalCartesian.vb
37 *
38 * <B>INTERFACE DIFFERENCES:</B><BR>
39 * Constructors have been provided that assume WGS84 parameters.
40 *
41 * The following functions are implemented as properties:
42 * LatitudeOrigin, LongitudeOrigin, HeightOrigin, EquatorialRadius,
43 * and Flattening.
44 *
45 * The rotation matrices returned by the Forward and Reverse functions
46 * are 2D, 3 &times; 3 arrays rather than vectors.
47 **********************************************************************/
48 public ref class LocalCartesian
49 {
50 private:
51 // the pointer to the GeographicLib::LocalCartesian.
52 GeographicLib::LocalCartesian* m_pLocalCartesian;
53
54 // the finalizer frees the unmanaged memory when the object is destroyed.
55 !LocalCartesian(void);
56 public:
57
58 /**
59 * Constructor setting the origin.
60 *
61 * @param[in] lat0 latitude at origin (degrees).
62 * @param[in] lon0 longitude at origin (degrees).
63 * @param[in] h0 height above ellipsoid at origin (meters); default 0.
64 * @param[in] earth Geocentric object for the transformation; default
65 * Geocentric::WGS84.
66 *
67 * \e lat0 should be in the range [&minus;90&deg;, 90&deg;].
68 **********************************************************************/
69 LocalCartesian(double lat0, double lon0, double h0,
70 Geocentric^ earth );
71
72 /**
73 * Constructor setting the origin and assuming a WGS84 ellipsoid.
74 *
75 * @param[in] lat0 latitude at origin (degrees).
76 * @param[in] lon0 longitude at origin (degrees).
77 * @param[in] h0 height above ellipsoid at origin (meters); default 0.
78 *
79 * \e lat0 should be in the range [&minus;90&deg;, 90&deg;].
80 **********************************************************************/
81 LocalCartesian(double lat0, double lon0, double h0 );
82
83 /**
84 * Constructor that uses the provided ellipsoid.
85 *
86 * @param[in] earth Geocentric object for the transformation; default
87 * Geocentric::WGS84.
88 *
89 * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0.
90 **********************************************************************/
92
93 /**
94 * The default constructor assumes the WGS84 ellipsoid.
95 *
96 * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0.
97 **********************************************************************/
99
100 /**
101 * The destructor calls the finalizer.
102 **********************************************************************/
104 { this->!LocalCartesian(); }
105
106 /**
107 * Reset the origin.
108 *
109 * @param[in] lat0 latitude at origin (degrees).
110 * @param[in] lon0 longitude at origin (degrees).
111 * @param[in] h0 height above ellipsoid at origin (meters); default 0.
112 *
113 * \e lat0 should be in the range [&minus;90&deg;, 90&deg;].
114 **********************************************************************/
115 void Reset(double lat0, double lon0, double h0 );
116
117 /**
118 * Convert from geodetic to local cartesian coordinates.
119 *
120 * @param[in] lat latitude of point (degrees).
121 * @param[in] lon longitude of point (degrees).
122 * @param[in] h height of point above the ellipsoid (meters).
123 * @param[out] x local cartesian coordinate (meters).
124 * @param[out] y local cartesian coordinate (meters).
125 * @param[out] z local cartesian coordinate (meters).
126 *
127 * \e lat should be in the range [&minus;90&deg;, 90&deg;].
128 **********************************************************************/
129 void Forward(double lat, double lon, double h,
130 [System::Runtime::InteropServices::Out] double% x,
131 [System::Runtime::InteropServices::Out] double% y,
132 [System::Runtime::InteropServices::Out] double% z);
133
134 /**
135 * Convert from geodetic to local cartesian coordinates and return rotation
136 * matrix.
137 *
138 * @param[in] lat latitude of point (degrees).
139 * @param[in] lon longitude of point (degrees).
140 * @param[in] h height of point above the ellipsoid (meters).
141 * @param[out] x local cartesian coordinate (meters).
142 * @param[out] y local cartesian coordinate (meters).
143 * @param[out] z local cartesian coordinate (meters).
144 * @param[out] M a 3 &times; 3 rotation matrix.
145 *
146 * \e lat should be in the range [&minus;90&deg;, 90&deg;].
147 *
148 * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can
149 * express \e v as \e column vectors in one of two ways
150 * - in east, north, up coordinates (where the components are relative to a
151 * local coordinate system at (\e lat, \e lon, \e h)); call this
152 * representation \e v1.
153 * - in \e x, \e y, \e z coordinates (where the components are relative to
154 * the local coordinate system at (\e lat0, \e lon0, \e h0)); call this
155 * representation \e v0.
156 * .
157 * Then we have \e v0 = \e M &sdot; \e v1.
158 **********************************************************************/
159 void Forward(double lat, double lon, double h,
160 [System::Runtime::InteropServices::Out] double% x,
161 [System::Runtime::InteropServices::Out] double% y,
162 [System::Runtime::InteropServices::Out] double% z,
163 [System::Runtime::InteropServices::Out] array<double,2>^% M);
164
165 /**
166 * Convert from local cartesian to geodetic coordinates.
167 *
168 * @param[in] x local cartesian coordinate (meters).
169 * @param[in] y local cartesian coordinate (meters).
170 * @param[in] z local cartesian coordinate (meters).
171 * @param[out] lat latitude of point (degrees).
172 * @param[out] lon longitude of point (degrees).
173 * @param[out] h height of point above the ellipsoid (meters).
174 *
175 * The value of \e lon returned is in the range [&minus;180&deg;,
176 * 180&deg;).
177 **********************************************************************/
178 void Reverse(double x, double y, double z,
179 [System::Runtime::InteropServices::Out] double% lat,
180 [System::Runtime::InteropServices::Out] double% lon,
181 [System::Runtime::InteropServices::Out] double% h);
182
183 /**
184 * Convert from local cartesian to geodetic coordinates and return rotation
185 * matrix.
186 *
187 * @param[in] x local cartesian coordinate (meters).
188 * @param[in] y local cartesian coordinate (meters).
189 * @param[in] z local cartesian coordinate (meters).
190 * @param[out] lat latitude of point (degrees).
191 * @param[out] lon longitude of point (degrees).
192 * @param[out] h height of point above the ellipsoid (meters).
193 * @param[out] M a 3 &times; 3 rotation matrix.
194 *
195 * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can
196 * express \e v as \e column vectors in one of two ways
197 * - in east, north, up coordinates (where the components are relative to a
198 * local coordinate system at (\e lat, \e lon, \e h)); call this
199 * representation \e v1.
200 * - in \e x, \e y, \e z coordinates (where the components are relative to
201 * the local coordinate system at (\e lat0, \e lon0, \e h0)); call this
202 * representation \e v0.
203 * .
204 * Then we have \e v1 = \e M<sup>T</sup> &sdot; \e v0, where \e
205 * M<sup>T</sup> is the transpose of \e M.
206 **********************************************************************/
207 void Reverse(double x, double y, double z,
208 [System::Runtime::InteropServices::Out] double% lat,
209 [System::Runtime::InteropServices::Out] double% lon,
210 [System::Runtime::InteropServices::Out] double% h,
211 [System::Runtime::InteropServices::Out] array<double,2>^% M);
212
213 /** \name Inspector functions
214 **********************************************************************/
215 ///@{
216 /**
217 * @return latitude of the origin (degrees).
218 **********************************************************************/
219 property double LatitudeOrigin { double get(); }
220
221 /**
222 * @return longitude of the origin (degrees).
223 **********************************************************************/
224 property double LongitudeOrigin { double get(); }
225
226 /**
227 * @return height of the origin (meters).
228 **********************************************************************/
229 property double HeightOrigin { double get(); }
230
231 /**
232 * @return \e a the equatorial radius of the ellipsoid (meters). This is
233 * the value of \e a inherited from the Geocentric object used in the
234 * constructor.
235 **********************************************************************/
236 property double EquatorialRadius { double get(); }
237
238 /**
239 * @return \e f the flattening of the ellipsoid. This is the value
240 * inherited from the Geocentric object used in the constructor.
241 **********************************************************************/
242 property double Flattening { double get(); }
243 ///@}
244 };
245} // namespace NETGeographicLib
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:69
.NET wrapper for GeographicLib::LocalCartesian.
void Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z, [System::Runtime::InteropServices::Out] array< double, 2 >^% M)
LocalCartesian(double lat0, double lon0, double h0, Geocentric^ earth)
void Reset(double lat0, double lon0, double h0)
void Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z)
void Reverse(double x, double y, double z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h)
LocalCartesian(Geocentric^ earth)
LocalCartesian(double lat0, double lon0, double h0)