mf
Media Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
spherical_coordinates.h
Go to the documentation of this file.
1 #ifndef MF_SPHERICAL_COORDINATES_H_
2 #define MF_SPHERICAL_COORDINATES_H_
3 
4 #include "angle.h"
5 #include <iosfwd>
6 #include "../eigen.h"
7 
8 namespace mf {
9 
11 
17  float radius = 0.0f;
18  angle azimuth = 0.0f;
19  angle elevation = 0.0f;
20 
21  spherical_coordinates() = default;
23  spherical_coordinates(float r, angle az, angle el) :
24  radius(r), azimuth(az), elevation(el) { }
25 
26  static spherical_coordinates from_cartesian(const Eigen::Vector3f&);
27  Eigen::Vector3f to_cartesian() const;
28 
29  bool operator==(const spherical_coordinates&) const;
30  bool operator!=(const spherical_coordinates&) const;
31 
32  void invalidate() { radius = 0; }
33  bool valid() const { return (radius != 0); }
34  explicit operator bool () const { return valid(); }
35 };
36 
37 
38 std::ostream& operator<<(std::ostream&, const spherical_coordinates&);
39 
40 }
41 
42 #endif
bool valid() const
Definition: spherical_coordinates.h:33
spherical_coordinates(float r, angle az, angle el)
Definition: spherical_coordinates.h:23
void invalidate()
Definition: spherical_coordinates.h:32
bool operator!=(const spherical_coordinates &) const
Definition: spherical_coordinates.cc:35
angle elevation
Definition: spherical_coordinates.h:19
Eigen::Vector3f to_cartesian() const
Definition: spherical_coordinates.cc:18
static spherical_coordinates from_cartesian(const Eigen::Vector3f &)
Definition: spherical_coordinates.cc:8
angle azimuth
Definition: spherical_coordinates.h:18
Spherical coordinates.
Definition: spherical_coordinates.h:16
float radius
Definition: spherical_coordinates.h:17
Angle, represented in radiants.
Definition: angle.h:12
bool operator==(const spherical_coordinates &) const
Definition: spherical_coordinates.cc:27
std::ostream & operator<<(std::ostream &str, const time_span &span)
Definition: common.h:76