W3C home > Mailing lists > Public > public-device-apis-log@w3.org > February 2017

Re: [sensors] Provide the DeviceOrientation sensor

From: Tobie Langel via GitHub <sysbot+gh@w3.org>
Date: Tue, 28 Feb 2017 18:53:59 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-283118404-1488305396-sysbot+gh@w3.org>
> Vectors and quaternions are easy

Well, are they really?

There's a different cost to each API:

```js
sensor.quaternion; // returns TypedArray 
```
benefit: simpler than BYOB, plays well with WebGL
cost: GC

```js
sensor.acceleration, sensor.x, sensor.y, sensor.z  ; // returns floats
 corresponding to the quaternion values
```
benefit: simpler than BYOB, GC
cost: doesn't play well with WebGL

```js
sensor.buffer = buffer;
requestAnimationFrame(_ => buffer); // returns TypedArray
```
benefit: GC, plays well with WebGL
cost: dev complexity, especially for simple cases

-- 
GitHub Notification of comment by tobie
Please view or discuss this issue at 
https://github.com/w3c/sensors/issues/170#issuecomment-283118404 using
 your GitHub account
Received on Tuesday, 28 February 2017 18:54:06 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:53 UTC