Gazebo Math

API Reference

9.0.0~pre1
SphericalCoordinates.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_MATH_SPHERICALCOORDINATES_HH_
18#define GZ_MATH_SPHERICALCOORDINATES_HH_
19
20#include <optional>
21#include <string>
22
23#include <gz/math/Angle.hh>
25#include <gz/math/Vector3.hh>
26#include <gz/math/Helpers.hh>
27#include <gz/math/config.hh>
28#include <gz/utils/ImplPtr.hh>
29
30namespace gz::math
31{
32 // Inline bracket to help doxygen filtering.
33 inline namespace GZ_MATH_VERSION_NAMESPACE {
34
37 {
40 public: enum SurfaceType
41 {
44 EARTH_WGS84 = 1,
45
49 MOON_SCS = 2,
50
52 CUSTOM_SURFACE = 10
53 };
54
57 public: enum CoordinateType
58 {
60 SPHERICAL = 1,
61
63 ECEF = 2,
64
66 GLOBAL = 3,
67
69 LOCAL = 4,
70 };
71
74
77 public: explicit SphericalCoordinates(const SurfaceType _type);
78
85 const SurfaceType _type,
86 const double _axisEquatorial,
87 const double _axisPolar);
88
98 const double _elevation,
100
108 public: std::optional<math::CoordinateVector3> SphericalFromLocalPosition(
109 const gz::math::CoordinateVector3 &_xyz) const;
110
118 public: std::optional<math::CoordinateVector3> GlobalFromLocalVelocity(
119 const gz::math::CoordinateVector3 &_xyz) const;
120
125 public: static SurfaceType Convert(const std::string &_str);
126
131
142 public: static double DistanceWGS84(
143 const gz::math::Angle &_latA,
144 const gz::math::Angle &_lonA,
145 const gz::math::Angle &_latB,
146 const gz::math::Angle &_lonB);
147
157 public: double DistanceBetweenPoints(
158 const gz::math::Angle &_latA,
159 const gz::math::Angle &_lonA,
160 const gz::math::Angle &_latB,
161 const gz::math::Angle &_lonB);
162
165 public: SurfaceType Surface() const;
166
169 public: double SurfaceRadius() const;
170
173 public: double SurfaceAxisEquatorial() const;
174
177 public: double SurfaceAxisPolar() const;
178
181 public: double SurfaceFlattening() const;
182
186
190
193 public: double ElevationReference() const;
194
200
203 public: void SetSurface(const SurfaceType &_type);
204
210 public: void SetSurface(
211 const SurfaceType &_type,
212 const double _axisEquatorial,
213 const double _axisPolar);
214
218
222
225 public: void SetElevationReference(const double _elevation);
226
230
236 public: std::optional<math::CoordinateVector3> LocalFromSphericalPosition(
238
244 public: std::optional<math::CoordinateVector3> LocalFromGlobalVelocity(
245 const gz::math::CoordinateVector3 &_xyz) const;
246
249
256 public: std::optional<gz::math::CoordinateVector3>
258 const CoordinateType &_in, const CoordinateType &_out) const;
259
266 public: std::optional<gz::math::CoordinateVector3> VelocityTransform(
268 const CoordinateType &_in, const CoordinateType &_out) const;
269
273 public: bool operator==(const SphericalCoordinates &_sc) const;
274
278 public: bool operator!=(const SphericalCoordinates &_sc) const;
279
281 GZ_UTILS_IMPL_PTR(dataPtr)
282 };
283 } // namespace GZ_MATH_VERSION_NAMESPACE
284} // namespace gz::math
285#endif // GZ_MATH_SPHERICALCOORDINATES_HH_