A. Data Preparation
The first step of the preparation stage is to combine the accelerometer and magnetometer readings using the Android
native API. The result is a quaternion representing a rough approximation of the device’s orientation. Its rotation contains
noise that can be attenuated by applying a low-pass filter. A set of transformations is applied so that the data matches the
3D engine’s orthogonal configuration.