【发布时间】:2012-02-15 17:33:08
【问题描述】:
我正在尝试获取 android 设备的方向,并且我需要它采用四元数结构(基本上是float[4])。
我现在拥有的是这样的:
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
last_acc = (float[])event.values.clone();
}
else if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD){
last_mag = (float[])event.values.clone();
}
if (last_acc != null && last_mag != null){
SensorManager.getRotationMatrix(rotation, inclination, last_acc, last_mag);
SensorManager.getOrientation(rotation, orientation);
在“旋转”中,我有 4x4 旋转矩阵,在方向上,我有一个 float[3] 向量,其中有方位角、俯仰角和滚动角。
我现在怎样才能得到四元数?
【问题讨论】:
标签: android android-sensors quaternions