- From: Rick Waldron via GitHub <sysbot+gh@w3.org>
- Date: Tue, 20 Sep 2016 21:55:15 +0000
- To: public-device-apis-log@w3.org
@marcoscaceres sorry I missed the original post. `Compass` & `Magnetometer` in J5 don't expose raw xyz magnetometer data (though they surely could), because generally the developer really just wants a heading in degrees, which is be computed from x and y. ``` let heading = Math.atan2(y, x); let pi_2 = Math.PI * 2; if (heading < 0) { heading += pi_2; } if (heading > pi_2) { heading -= pi_2; } let degrees = heading * (180 / Math.PI); ``` I view that as an undue burden on the developer. For true-north heading, just subtract a declination angle. The **z** in x, y, z is used for computing the earth's magnetic field—I've written a robot that can navigate from any lat/lon point to any _other_ lat/lon point using a gps and compass/magnetometer—no **z** necessary. -- GitHub Notification of comment by rwaldron Please view or discuss this issue at https://github.com/w3c/magnetometer/issues/3#issuecomment-248446835 using your GitHub account
Received on Tuesday, 20 September 2016 21:55:23 UTC