public class CategoryOrientationData extends SensorData<CategoryOrientation>
SensorData and describes data information of orientation sensors.
The data information includes the timestamps, accuracy, data values, and data dimensions of
sensors. This class also provides the method for constructing a CategoryOrientationData
instance.
SensorData,
CategoryOrientationSystemCapability.Sensors#SENSORaccuracy, DEFAULT_SENSOR_DATA_DIMS, sensor, sensorDataDim, timestamp, values| 构造器 | 说明 |
|---|---|
CategoryOrientationData(CategoryOrientation sensor,
int accuracy,
long timestamp,
int sensorDataDim,
float[] values) |
A constructor used to create a
CategoryOrientationData instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static float[] |
getDeviceOrientation(float[] rotationMatrix,
float[] rotationAngle) |
Obtains the device orientation based on the rotation matrix.
|
static void |
getDeviceRotationMatrix(float[] rotationMatrix,
float[] rotationVector) |
Obtains the rotation matrix of the current device position based on the rotation vector.
|
static float[] |
getQuaternionValues(float[] rotationVector) |
Obtains a quaternion from data of a rotation vector sensor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAccuracy, getSensor, getSensorDataDim, getTimestamp, getValuespublic CategoryOrientationData(CategoryOrientation sensor, int accuracy, long timestamp, int sensorDataDim, float[] values)
CategoryOrientationData instance.sensor - Indicates a sensor.accuracy - Indicates the sensor accuracy.timestamp - Indicates the sensor timestamp.sensorDataDim - Indicates the data dimension of the sensor.values - Indicates the data values of the sensor.public static float[] getQuaternionValues(float[] rotationVector)
rotationVector - Indicates the rotation vector sensor data, in which the first four
elements represent the x, y, z, and w components respectively.public static void getDeviceRotationMatrix(float[] rotationMatrix,
float[] rotationVector)
rotationMatrix - Indicates a floating-point array to store the rotation matrix. The
array length can be 9 (to store a three-dimensional rotation matrix) or 16 (to store a
four-dimensional rotation matrix).rotationVector - Indicates the rotation vector.public static float[] getDeviceOrientation(float[] rotationMatrix,
float[] rotationAngle)
rotationMatrix - Indicates the rotation matrix, which can be obtained via getDeviceRotationMatrix(float[], float[]).rotationAngle - Indicates a floating-point array to store the three device orientation
values. The value rotationAngle[0] indicates rotation around the Z axis. It
represents the azimuth, that is, the angle between the Y axis of the device and the magnetic
north pole. rotationAngle[1] indicates rotation around the X axis. It represents the
pitch, that is, the angle between the plane parallel to the device screen and the plane
parallel to the ground. rotationAngle[2] indicates rotation around the Y axis. It
represents the roll, that is, the angle between the plane perpendicular to the device screen
and the plane perpendicular to the ground.rotationAngle values.