Created SphericalPoint in array_util.h
Review URL: https://codereview.webrtc.org/1211703002
Cr-Original-Commit-Position: refs/heads/master@{#9507}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: ebe7422372c561a017990ac59e15e58a2f02d8eb
diff --git a/modules/audio_processing/beamformer/array_util.h b/modules/audio_processing/beamformer/array_util.h
index 8d1cda7..f7598c0 100644
--- a/modules/audio_processing/beamformer/array_util.h
+++ b/modules/audio_processing/beamformer/array_util.h
@@ -23,19 +23,13 @@
c[1] = y;
c[2] = z;
}
- T x() const {
- return c[0];
- }
- T y() const {
- return c[1];
- }
- T z() const {
- return c[2];
- }
+ T x() const { return c[0]; }
+ T y() const { return c[1]; }
+ T z() const { return c[2]; }
T c[3];
};
-typedef CartesianPoint<float> Point;
+using Point = CartesianPoint<float>;
template<typename T>
float Distance(CartesianPoint<T> a, CartesianPoint<T> b) {
@@ -44,6 +38,21 @@
(a.z() - b.z()) * (a.z() - b.z()));
}
+template <typename T>
+struct SphericalPoint {
+ SphericalPoint(T azimuth, T elevation, T radius) {
+ s[0] = azimuth;
+ s[1] = elevation;
+ s[2] = radius;
+ }
+ T azimuth() const { return s[0]; }
+ T elevation() const { return s[1]; }
+ T distance() const { return s[2]; }
+ T s[3];
+};
+
+using SphericalPointf = SphericalPoint<float>;
+
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_ARRAY_UTIL_H_