Ignition Math

API Reference

6.9.3~pre2
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 IGNITION_MATH_SPHERICALCOORDINATES_HH_
18 #define IGNITION_MATH_SPHERICALCOORDINATES_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <ignition/math/Angle.hh>
24 #include <ignition/math/Vector3.hh>
25 #include <ignition/math/Helpers.hh>
26 #include <ignition/math/config.hh>
27 
28 namespace ignition
29 {
30  namespace math
31  {
32  // Inline bracket to help doxygen filtering.
33  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
34  //
35  class SphericalCoordinatesPrivate;
36 
38  class IGNITION_MATH_VISIBLE SphericalCoordinates
39  {
42  public: enum SurfaceType
43  {
46  EARTH_WGS84 = 1
47  };
48 
51  public: enum CoordinateType
52  {
54  SPHERICAL = 1,
55 
57  ECEF = 2,
58 
60  GLOBAL = 3,
61 
65  LOCAL = 4,
66 
68  LOCAL2 = 5
69  };
70 
72  public: SphericalCoordinates();
73 
76  public: explicit SphericalCoordinates(const SurfaceType _type);
77 
84  public: SphericalCoordinates(const SurfaceType _type,
85  const ignition::math::Angle &_latitude,
86  const ignition::math::Angle &_longitude,
87  const double _elevation,
88  const ignition::math::Angle &_heading);
89 
92  public: SphericalCoordinates(const SphericalCoordinates &_sc);
93 
95  public: ~SphericalCoordinates();
96 
110  public: ignition::math::Vector3d SphericalFromLocalPosition(
111  const ignition::math::Vector3d &_xyz) const;
112 
124  public: ignition::math::Vector3d GlobalFromLocalVelocity(
125  const ignition::math::Vector3d &_xyz) const;
126 
131  public: static SurfaceType Convert(const std::string &_str);
132 
136  public: static std::string Convert(SurfaceType _type);
137 
147  public: static double Distance(const ignition::math::Angle &_latA,
148  const ignition::math::Angle &_lonA,
149  const ignition::math::Angle &_latB,
150  const ignition::math::Angle &_lonB);
151 
154  public: SurfaceType Surface() const;
155 
158  public: ignition::math::Angle LatitudeReference() const;
159 
162  public: ignition::math::Angle LongitudeReference() const;
163 
166  public: double ElevationReference() const;
167 
172  public: ignition::math::Angle HeadingOffset() const;
173 
176  public: void SetSurface(const SurfaceType &_type);
177 
180  public: void SetLatitudeReference(const ignition::math::Angle &_angle);
181 
184  public: void SetLongitudeReference(const ignition::math::Angle &_angle);
185 
188  public: void SetElevationReference(const double _elevation);
189 
192  public: void SetHeadingOffset(const ignition::math::Angle &_angle);
193 
199  public: ignition::math::Vector3d LocalFromSphericalPosition(
200  const ignition::math::Vector3d &_latLonEle) const;
201 
207  public: ignition::math::Vector3d LocalFromGlobalVelocity(
208  const ignition::math::Vector3d &_xyz) const;
209 
211  public: void UpdateTransformationMatrix();
212 
220  PositionTransform(const ignition::math::Vector3d &_pos,
221  const CoordinateType &_in, const CoordinateType &_out) const;
222 
229  public: ignition::math::Vector3d VelocityTransform(
230  const ignition::math::Vector3d &_vel,
231  const CoordinateType &_in, const CoordinateType &_out) const;
232 
236  public: bool operator==(const SphericalCoordinates &_sc) const;
237 
241  public: bool operator!=(const SphericalCoordinates &_sc) const;
242 
246  public: SphericalCoordinates &operator=(
247  const SphericalCoordinates &_sc);
248 
249 
250 #ifdef _WIN32
251 // Disable warning C4251 which is triggered by
252 // std::unique_ptr
253 #pragma warning(push)
254 #pragma warning(disable: 4251)
255 #endif
259 #ifdef _WIN32
260 #pragma warning(pop)
261 #endif
262  };
263  }
264  }
265 }
266 #endif
The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees.
Definition: Angle.hh:61
CoordinateType
Unique identifiers for coordinate types.
Definition: SphericalCoordinates.hh:51
SurfaceType
Unique identifiers for planetary surface models.
Definition: SphericalCoordinates.hh:42
STL class.
The Vector3 class represents the generic vector containing 3 elements. Since it&#39;s commonly used to ke...
Definition: Vector3.hh:41
Convert spherical coordinates for planetary surfaces.
Definition: SphericalCoordinates.hh:38
Definition: Angle.hh:42