Ignition Math

API Reference

6.4.0
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 
39  class IGNITION_MATH_VISIBLE SphericalCoordinates
40  {
43  public: enum SurfaceType
44  {
47  EARTH_WGS84 = 1
48  };
49 
52  public: enum CoordinateType
53  {
55  SPHERICAL = 1,
56 
58  ECEF = 2,
59 
61  GLOBAL = 3,
62 
64  LOCAL = 4
65  };
66 
68  public: SphericalCoordinates();
69 
72  public: explicit SphericalCoordinates(const SurfaceType _type);
73 
80  public: SphericalCoordinates(const SurfaceType _type,
81  const ignition::math::Angle &_latitude,
82  const ignition::math::Angle &_longitude,
83  const double _elevation,
84  const ignition::math::Angle &_heading);
85 
88  public: SphericalCoordinates(const SphericalCoordinates &_sc);
89 
91  public: ~SphericalCoordinates();
92 
97  public: ignition::math::Vector3d SphericalFromLocalPosition(
98  const ignition::math::Vector3d &_xyz) const;
99 
104  public: ignition::math::Vector3d GlobalFromLocalVelocity(
105  const ignition::math::Vector3d &_xyz) const;
106 
111  public: static SurfaceType Convert(const std::string &_str);
112 
122  public: static double Distance(const ignition::math::Angle &_latA,
123  const ignition::math::Angle &_lonA,
124  const ignition::math::Angle &_latB,
125  const ignition::math::Angle &_lonB);
126 
129  public: SurfaceType Surface() const;
130 
133  public: ignition::math::Angle LatitudeReference() const;
134 
137  public: ignition::math::Angle LongitudeReference() const;
138 
141  public: double ElevationReference() const;
142 
147  public: ignition::math::Angle HeadingOffset() const;
148 
151  public: void SetSurface(const SurfaceType &_type);
152 
155  public: void SetLatitudeReference(const ignition::math::Angle &_angle);
156 
159  public: void SetLongitudeReference(const ignition::math::Angle &_angle);
160 
163  public: void SetElevationReference(const double _elevation);
164 
167  public: void SetHeadingOffset(const ignition::math::Angle &_angle);
168 
172  public: ignition::math::Vector3d LocalFromSphericalPosition(
173  const ignition::math::Vector3d &_xyz) const;
174 
179  public: ignition::math::Vector3d LocalFromGlobalVelocity(
180  const ignition::math::Vector3d &_xyz) const;
181 
183  public: void UpdateTransformationMatrix();
184 
191  PositionTransform(const ignition::math::Vector3d &_pos,
192  const CoordinateType &_in, const CoordinateType &_out) const;
193 
199  public: ignition::math::Vector3d VelocityTransform(
200  const ignition::math::Vector3d &_vel,
201  const CoordinateType &_in, const CoordinateType &_out) const;
202 
206  public: bool operator==(const SphericalCoordinates &_sc) const;
207 
211  public: bool operator!=(const SphericalCoordinates &_sc) const;
212 
216  public: SphericalCoordinates &operator=(
217  const SphericalCoordinates &_sc);
218 
219 
220 #ifdef _WIN32
221 // Disable warning C4251 which is triggered by
222 // std::unique_ptr
223 #pragma warning(push)
224 #pragma warning(disable: 4251)
225 #endif
229 #ifdef _WIN32
230 #pragma warning(pop)
231 #endif
232  };
234  }
235  }
236 }
237 #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:52
SurfaceType
Unique identifiers for planetary surface models.
Definition: SphericalCoordinates.hh:43
STL class.
The Vector3 class represents the generic vector containing 3 elements. Since it&#39;s commonly used to ke...
Definition: Vector3.hh:40
Convert spherical coordinates for planetary surfaces.
Definition: SphericalCoordinates.hh:39
Definition: Angle.hh:42