Re: [magnetometer] Why magneticFieldX instead of x?

## Comparison, deriving heading in degrees: 


### MagnetometerSensor

```js
let sensor = new MagnetometerSensor();
sensor.start();

sensor.onchange = (event) => {
  let { magneticFieldX: x, magneticFieldY: y } = event.reading;
  let h = Math.atan2(y, x);
  let pi2 = Math.PI * 2;

  if (h < 0) {
    h += pi2;
  }

  if (h > pi2) {
    h -= pi2;
  }

  console.log(h * (180 / Math.PI));
};
```

### five.Magnetometer

```js
let sensor = new five.Magnetometer({ controller: "HMC5883L" });
sensor.on("change", () => {
  console.log(sensor.heading);
});
```


-- 
GitHub Notification of comment by rwaldron
Please view or discuss this issue at 
https://github.com/w3c/magnetometer/issues/3#issuecomment-248452500 
using your GitHub account

Received on Tuesday, 20 September 2016 22:20:38 UTC