| Index: media/audio/point.h
|
| diff --git a/media/audio/point.h b/media/audio/point.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8babd0dd60064c90a121d6f3a2b1554dfdadb586
|
| --- /dev/null
|
| +++ b/media/audio/point.h
|
| @@ -0,0 +1,57 @@
|
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef MEDIA_AUDIO_MIC_POSITIONS_H_
|
| +#define MEDIA_AUDIO_MIC_POSITIONS_H_
|
| +
|
| +#include <cmath>
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "media/base/media_export.h"
|
| +
|
| +namespace media {
|
| +
|
| +// Represents a 3D point using Cartesian coordinates in meters.
|
| +class MEDIA_EXPORT Point final {
|
| + public:
|
| + Point();
|
| + Point(float x, float y, float z);
|
| +
|
| + float x() const { return x_; }
|
| + float y() const { return y_; }
|
| + float z() const { return z_; }
|
| +
|
| + // Checks that all coordinates are finite (not infinite or NaN).
|
| + bool IsValid() const;
|
| +
|
| + // Returns a human-readable string of the coordinates.
|
| + std::string ToString() const;
|
| +
|
| + Point(const Point&) = default;
|
| + Point& operator=(const Point&) = default;
|
| +
|
| + bool operator==(const Point& rhs) const {
|
| + return x_ == rhs.x_ && y_ == rhs.y_ && z_ == rhs.z_;
|
| + }
|
| +
|
| + bool operator!=(const Point& rhs) const { return !(*this == rhs); }
|
| +
|
| + private:
|
| + float x_;
|
| + float y_;
|
| + float z_;
|
| +};
|
| +
|
| +// Returns a vector of points parsed from a whitespace-separated string
|
| +// formatted
|
| +// as: "x1 y1 z1 ... zn yn zn" for n points.
|
| +//
|
| +// Returns an empty vector if |points_string| is empty or isn't parseable.
|
| +MEDIA_EXPORT std::vector<Point> ParsePointsFromString(
|
| + const std::string& points_string);
|
| +
|
| +} // namespace media
|
| +
|
| +#endif // MEDIA_AUDIO_MIC_POSITIONS_H_
|
|
|