public class OrientationSensorUtil
extends java.lang.Object
OrientationSensor
,
placed in this static utility class for easier testing.Modifier and Type | Method and Description |
---|---|
static float |
normalizeAzimuth(float azimuth)
Normalizes azimuth to be in the range [0, 360).
|
static float |
normalizePitch(float pitch)
Normalizes pitch to be in the range [-180, +180).
|
static float |
normalizeRoll(float roll)
Normalizes roll to be in the range [-90, +90] degrees.
|
public static float normalizeAzimuth(float azimuth)
azimuth
- an angle in degrees, likely to be in (-360, +360)public static float normalizePitch(float pitch)
pitch
- an angle in degrees, likely to be in (-360, +360)public static float normalizeRoll(float roll)
0 degrees when the device is level, increasing to 90 degrees as the device is tilted up onto its left side, and decreasing to -90 degrees when the device is tilted up onto its right side.After rotating the phone more than 90 degrees, Roll decreased. For compatibility, we are guaranteeing the same behavior.
roll
- an angle likely to be in the range [-180, +180]