AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.util.OrientationSensorUtil Class Reference

Static Public Member Functions

static float normalizeAzimuth (float azimuth)
 
static float normalizePitch (float pitch)
 
static float normalizeRoll (float roll)
 

Detailed Description

Functionality related to com.google.appinventor.components.runtime.OrientationSensor, placed in this static utility class for easier testing.

Definition at line 15 of file OrientationSensorUtil.java.

Member Function Documentation

◆ normalizeAzimuth()

static float com.google.appinventor.components.runtime.util.OrientationSensorUtil.normalizeAzimuth ( float  azimuth)
static

Normalizes azimuth to be in the range [0, 360).

Parameters
azimuthan angle in degrees, likely to be in (-360, +360)
Returns
an equivalent angle in the range [0, 360)

Definition at line 47 of file OrientationSensorUtil.java.

◆ normalizePitch()

static float com.google.appinventor.components.runtime.util.OrientationSensorUtil.normalizePitch ( float  pitch)
static

Normalizes pitch to be in the range [-180, +180).

Parameters
pitchan angle in degrees, likely to be in (-360, +360)
Returns
an equivalent angle in the range [-180, +180)

Definition at line 57 of file OrientationSensorUtil.java.

◆ normalizeRoll()

static float com.google.appinventor.components.runtime.util.OrientationSensorUtil.normalizeRoll ( float  roll)
static

Normalizes roll to be in the range [-90, +90] degrees. The App Inventor definition of Roll in the documentation is:

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.

Parameters
rollan angle likely to be in the range [-180, +180]
Returns
the equivalent angle in the range [-90, +90], where angles with an absolute value greater than 90 are reflected over the x-axis; the value is not defined for inputs outside of [-180, +180]

Definition at line 79 of file OrientationSensorUtil.java.


The documentation for this class was generated from the following file: