summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/sensor/sensor_reading_remapper.h
blob: 8bcc8ddf92b01a16d023d069e854f9fa036b9901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2018 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 THIRD_PARTY_BLINK_RENDERER_MODULES_SENSOR_SENSOR_READING_REMAPPER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_SENSOR_SENSOR_READING_REMAPPER_H_

#include "services/device/public/cpp/generic_sensor/sensor_reading.h"
#include "services/device/public/mojom/sensor.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"

namespace blink {

class SensorReadingRemapper {
  STATIC_ONLY(SensorReadingRemapper);

 public:
  // For spatial sensors, remaps coordinates to the
  // screen coordinate system, i.e. performs clockwise
  // rotation |orientation_angle| degrees around Z-axis:
  // |  cos(a) sin(a)  0||x|
  // | -sin(a) cos(a)  0||y|
  // |      0      0   1||z|
  static void RemapToScreenCoords(device::mojom::blink::SensorType,
                                  uint16_t orientation_angle,
                                  device::SensorReading*);
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_SENSOR_SENSOR_READING_REMAPPER_H_