Wayverb
az_el.h
1 #pragma once
2 
3 #include "glm/glm.hpp"
4 
5 #include <tuple>
6 
7 namespace wayverb {
8 namespace core {
9 
10 struct az_el final {
11  constexpr az_el() = default;
12  constexpr az_el(float both)
13  : azimuth{both}
14  , elevation{both} {}
15  constexpr az_el(float azimuth, float elevation)
16  : azimuth{azimuth}
17  , elevation{elevation} {}
18 
19  float azimuth{0};
20  float elevation{0};
21 };
22 
23 az_el& operator+=(az_el& a, const az_el& b);
24 az_el& operator-=(az_el& a, const az_el& b);
25 az_el& operator*=(az_el& a, const az_el& b);
26 az_el& operator/=(az_el& a, const az_el& b);
27 
28 az_el operator+(const az_el& a, const az_el& b);
29 az_el operator-(const az_el& a, const az_el& b);
30 az_el operator*(const az_el& a, const az_el& b);
31 az_el operator/(const az_el& a, const az_el& b);
32 
33 float compute_azimuth(const glm::vec3& pointing);
34 float compute_elevation(const glm::vec3& pointing);
35 az_el compute_azimuth_elevation(const glm::vec3& pointing);
36 
37 glm::vec3 compute_pointing(const az_el& azel);
38 
39 constexpr auto to_tuple(az_el& x) {
40  return std::tie(x.azimuth, x.elevation);
41 }
42 
43 constexpr auto to_tuple(const az_el&x) {
44  return std::tie(x.azimuth, x.elevation);
45 }
46 
47 constexpr auto operator==(const az_el& a, const az_el& b) {
48  return to_tuple(a) == to_tuple(b);
49 }
50 
51 constexpr auto operator!=(const az_el& a, const az_el& b) {
52  return !(a == b);
53 }
54 
55 } // namespace core
56 } // namespace wayverb
Definition: traits.cpp:2
Definition: capsule_base.h:9
Definition: az_el.h:10