Gazebo Math
API Reference
8.1.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-math
include
gz
math
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
>
24
#include <
gz/math/CoordinateVector3.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
30
// MSVC doesn't like deprecating enum values with function macros
31
#if _MSC_VER
32
#define GZ_LOCAL2_DEPRECATED [[deprecated]]
33
#else
34
#define GZ_LOCAL2_DEPRECATED GZ_DEPRECATED(8)
35
#endif
36
37
namespace
gz::math
38
{
39
// Inline bracket to help doxygen filtering.
40
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
41
43
class
GZ_MATH_VISIBLE
SphericalCoordinates
44
{
47
public
:
enum
SurfaceType
48
{
51
EARTH_WGS84 = 1,
52
56
MOON_SCS = 2,
57
59
CUSTOM_SURFACE = 10
60
};
61
64
public
:
enum
CoordinateType
65
{
67
SPHERICAL = 1,
68
70
ECEF = 2,
71
73
GLOBAL = 3,
74
76
LOCAL = 4,
77
82
LOCAL2
GZ_LOCAL2_DEPRECATED
= 5
83
};
84
86
public
:
SphericalCoordinates
();
87
90
public
:
explicit
SphericalCoordinates
(
const
SurfaceType
_type
);
91
97
public
:
SphericalCoordinates
(
98
const
SurfaceType
_type
,
99
const
double
_axisEquatorial
,
100
const
double
_axisPolar
);
101
108
public
:
SphericalCoordinates
(
const
SurfaceType
_type
,
109
const
gz::math::Angle
&
_latitude
,
110
const
gz::math::Angle
&
_longitude
,
111
const
double
_elevation
,
112
const
gz::math::Angle
&
_heading
);
113
126
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
SphericalFromLocalPosition(
127
const
gz
::math::
Vector3d
&
_xyz
)
const
;
128
136
public
:
std
::optional<math::
CoordinateVector3
> SphericalFromLocalPosition(
137
const
gz
::math::
CoordinateVector3
&
_xyz
)
const
;
138
151
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
GlobalFromLocalVelocity(
152
const
gz
::math::
Vector3d
&
_xyz
)
const
;
153
161
public
:
std
::optional<math::
CoordinateVector3
> GlobalFromLocalVelocity(
162
const
gz
::math::
CoordinateVector3
&
_xyz
)
const
;
163
168
public
:
static
SurfaceType
Convert(
const
std
::
string
&
_str
);
169
173
public
:
static
std
::
string
Convert(
SurfaceType
_type
);
174
185
public
:
static
double
DistanceWGS84(
186
const
gz
::math::
Angle
&
_latA
,
187
const
gz
::math::
Angle
&
_lonA
,
188
const
gz
::math::
Angle
&
_latB
,
189
const
gz
::math::
Angle
&
_lonB
);
190
202
public
:
double
DistanceBetweenPoints(
203
const
gz
::math::
Angle
&
_latA
,
204
const
gz
::math::
Angle
&
_lonA
,
205
const
gz
::math::
Angle
&
_latB
,
206
const
gz
::math::
Angle
&
_lonB
);
207
210
public
:
SurfaceType
Surface()
const
;
211
214
public
:
double
SurfaceRadius()
const
;
215
218
public
:
double
SurfaceAxisEquatorial()
const
;
219
222
public
:
double
SurfaceAxisPolar()
const
;
223
226
public
:
double
SurfaceFlattening()
const
;
227
230
public
:
gz
::math::
Angle
LatitudeReference()
const
;
231
234
public
:
gz
::math::
Angle
LongitudeReference()
const
;
235
238
public
:
double
ElevationReference()
const
;
239
244
public
:
gz
::math::
Angle
HeadingOffset()
const
;
245
248
public
:
void
SetSurface(
const
SurfaceType
&
_type
);
249
255
public
:
void
SetSurface(
256
const
SurfaceType
&
_type
,
257
const
double
_axisEquatorial
,
258
const
double
_axisPolar
);
259
262
public
:
void
SetLatitudeReference(
const
gz
::math::
Angle
&
_angle
);
263
266
public
:
void
SetLongitudeReference(
const
gz
::math::
Angle
&
_angle
);
267
270
public
:
void
SetElevationReference(
const
double
_elevation
);
271
274
public
:
void
SetHeadingOffset(
const
gz
::math::
Angle
&
_angle
);
275
282
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
LocalFromSphericalPosition(
283
const
gz
::math::
Vector3d
&
_latLonEle
)
const
;
284
290
public
:
std
::optional<math::
CoordinateVector3
> LocalFromSphericalPosition(
291
const
gz
::math::
CoordinateVector3
&
_latLonEle
)
const
;
292
299
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
LocalFromGlobalVelocity(
300
const
gz
::math::
Vector3d
&
_xyz
)
const
;
301
307
public
:
std
::optional<math::
CoordinateVector3
> LocalFromGlobalVelocity(
308
const
gz
::math::
CoordinateVector3
&
_xyz
)
const
;
309
311
public
:
void
UpdateTransformationMatrix();
312
329
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
330
PositionTransform(
const
gz
::math::
Vector3d
&
_pos
,
331
const
CoordinateType
&
_in
,
const
CoordinateType
&
_out
)
const
;
332
339
public
:
std
::optional<
gz
::math::
CoordinateVector3
>
340
PositionTransform(
const
gz
::math::
CoordinateVector3
&
_pos
,
341
const
CoordinateType
&
_in
,
const
CoordinateType
&
_out
)
const
;
342
358
public
:
GZ_DEPRECATED
(8)
gz
::math::
Vector3d
VelocityTransform(
359
const
gz
::math::
Vector3d
&
_vel
,
360
const
CoordinateType
&
_in
,
const
CoordinateType
&
_out
)
const
;
361
368
public
:
std
::optional<
gz
::math::
CoordinateVector3
> VelocityTransform(
369
const
gz
::math::
CoordinateVector3
&
_vel
,
370
const
CoordinateType
&
_in
,
const
CoordinateType
&
_out
)
const
;
371
375
public
:
bool
operator
==(
const
SphericalCoordinates
&
_sc
)
const
;
376
380
public
:
bool
operator
!=(
const
SphericalCoordinates
&
_sc
)
const
;
381
383
GZ_UTILS_IMPL_PTR
(dataPtr)
384
};
385
}
// namespace GZ_MATH_VERSION_NAMESPACE
386
}
// namespace gz::math
387
#endif
// GZ_MATH_SPHERICALCOORDINATES_HH_