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
CoordinateVector3.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2024 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_COORDINATE_VECTOR3_HH_
18
#define GZ_MATH_COORDINATE_VECTOR3_HH_
19
20
#include <optional>
21
#include <ostream>
22
23
#include <
gz/math/Angle.hh
>
24
#include <
gz/math/Vector3.hh
>
25
#include <
gz/math/Helpers.hh
>
26
#include <gz/math/config.hh>
27
#include <gz/utils/ImplPtr.hh>
28
29
namespace
gz::math
30
{
31
// Inline bracket to help doxygen filtering.
32
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
33
37
class
GZ_MATH_VISIBLE
CoordinateVector3
38
{
40
public
:
CoordinateVector3
();
41
42
public
:
~CoordinateVector3
();
43
46
public
:
CoordinateVector3
(
const
CoordinateVector3
&
_other
);
47
48
public
:
CoordinateVector3
(
CoordinateVector3
&&
_other
)
noexcept
;
49
55
public
:
static
CoordinateVector3
Metric
(
double
_x
,
double
_y
,
double
_z
);
56
60
public
:
static
CoordinateVector3
Metric
(
const
math::Vector3d
&
_v
);
61
67
public
:
static
CoordinateVector3
Spherical
(
68
const
math::Angle
&
_lat
,
const
math::Angle
&
_lon
,
double
_z
);
69
72
public
:
bool
IsMetric
()
const
;
73
76
public
:
bool
IsSpherical
()
const
;
77
82
public
:
void
SetMetric
(
double
_x
,
double
_y
,
double
_z
);
83
86
public
:
void
SetMetric
(
const
math::Vector3d
&
_v
);
87
92
public
:
void
SetSpherical
(
93
const
math::Angle
&
_lat
,
const
math::Angle
&
_lon
,
double
_z
);
94
97
public
: std::optional<math::Vector3d>
AsMetricVector
()
const
;
98
102
public
:
CoordinateVector3
&
operator=
(
const
CoordinateVector3
&
_other
);
103
107
public
:
CoordinateVector3
&
operator=
(
CoordinateVector3
&&
_other
)
noexcept
;
108
114
public
:
CoordinateVector3
operator+
(
const
CoordinateVector3
&
_v
)
const
;
115
121
public
:
const
CoordinateVector3
&
operator+=
(
const
CoordinateVector3
&
_v
);
122
125
public
:
CoordinateVector3
operator-
()
const
;
126
132
public
:
CoordinateVector3
operator-
(
const
CoordinateVector3
&
_pt
)
const
;
133
139
public
:
const
CoordinateVector3
&
operator-=
(
const
CoordinateVector3
&
_pt
);
140
147
public
:
bool
Equal
(
const
CoordinateVector3
&
_v
,
148
const
double
&
_tol
,
149
const
math::Angle
&
_ang_tol
)
const
;
150
155
public
:
bool
operator==
(
const
CoordinateVector3
&
_v
)
const
;
156
161
public
:
bool
operator!=
(
const
CoordinateVector3
&
_v
)
const
;
162
165
public
:
bool
IsFinite
()
const
;
166
171
public
:
bool
Equal
(
const
CoordinateVector3
&
_v
)
const
;
172
175
public
: std::optional<double>
X
()
const
;
176
179
public
: std::optional<math::Angle>
Lat
()
const
;
180
183
public
: std::optional<double>
Y
()
const
;
184
187
public
: std::optional<math::Angle>
Lon
()
const
;
188
191
public
: std::optional<double>
Z
()
const
;
192
196
public
:
bool
X
(
const
double
&
_v
);
197
201
public
:
bool
Lat
(
const
Angle
&
_v
);
202
206
public
:
bool
Y
(
const
double
&
_v
);
207
211
public
:
bool
Lon
(
const
Angle
&
_v
);
212
216
public
:
bool
Z
(
const
double
&
_v
);
217
222
public
:
friend
std::ostream
&
operator<<
(
223
std::ostream
&
_out
,
const
gz::math::CoordinateVector3
&
_pt
)
224
{
225
if
(
_pt
.IsMetric())
226
{
227
appendToStream
(
_out
, *
_pt
.X());
228
}
229
else
230
{
231
appendToStream
(
_out
,
_pt
.Lat()->Degree());
232
_out
<<
"°"
;
233
}
234
_out
<<
" "
;
235
236
if
(
_pt
.IsMetric())
237
{
238
appendToStream
(
_out
, *
_pt
.Y());
239
}
240
else
241
{
242
appendToStream
(
_out
,
_pt
.Lon()->Degree());
243
_out
<<
"°"
;
244
}
245
_out
<<
" "
;
246
247
appendToStream
(
_out
, *
_pt
.Z());
248
249
return
_out
;
250
}
251
252
GZ_UTILS_UNIQUE_IMPL_PTR
(dataPtr)
253
};
254
255
}
// namespace GZ_MATH_VERSION_NAMESPACE
256
}
// namespace gz::math
257
#endif
// GZ_MATH_COORDINATE_VECTOR3_HH_