OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_AUDIO_MIC_POSITIONS_H_ | |
DaleCurtis
2015/09/03 01:58:37
Header tag is not correct. Is it worth reusing ui/
ajm
2015/09/03 04:19:29
It appears to do everything we need except for the
Henrik Grunell
2015/09/03 07:14:20
If we can't use an existing point class, maybe a b
ajm
2015/09/09 01:01:29
gfx::Point3F works fine. I added a typedef below,
| |
6 #define MEDIA_AUDIO_MIC_POSITIONS_H_ | |
7 | |
8 #include <cmath> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "media/base/media_export.h" | |
13 | |
14 namespace media { | |
15 | |
16 // Represents a 3D point using Cartesian coordinates in meters. | |
17 class MEDIA_EXPORT Point final { | |
18 public: | |
19 Point(); | |
20 Point(float x, float y, float z); | |
21 | |
22 float x() const { return x_; } | |
23 float y() const { return y_; } | |
24 float z() const { return z_; } | |
25 | |
26 // Checks that all coordinates are finite (not infinite or NaN). | |
27 bool IsValid() const; | |
28 | |
29 // Returns a human-readable string of the coordinates. | |
30 std::string ToString() const; | |
31 | |
32 Point(const Point&) = default; | |
33 Point& operator=(const Point&) = default; | |
34 | |
35 bool operator==(const Point& rhs) const { | |
36 return x_ == rhs.x_ && y_ == rhs.y_ && z_ == rhs.z_; | |
37 } | |
38 | |
39 bool operator!=(const Point& rhs) const { return !(*this == rhs); } | |
40 | |
41 private: | |
42 float x_; | |
43 float y_; | |
44 float z_; | |
45 }; | |
46 | |
47 // Returns a vector of points parsed from a whitespace-separated string | |
48 // formatted | |
49 // as: "x1 y1 z1 ... zn yn zn" for n points. | |
50 // | |
51 // Returns an empty vector if |points_string| is empty or isn't parseable. | |
52 MEDIA_EXPORT std::vector<Point> ParsePointsFromString( | |
53 const std::string& points_string); | |
54 | |
55 } // namespace media | |
56 | |
57 #endif // MEDIA_AUDIO_MIC_POSITIONS_H_ | |
OLD | NEW |