Ale*_*lex 2 android quaternions android-sensors
我正在尝试获取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);
Run Code Online (Sandbox Code Playgroud)
在"旋转"中,我有4x4旋转矩阵,并且在方向上我有一个float [3]向量,其中我有方位角,俯仰和滚动.
我怎样才能得到四元数?
归档时间: |
|
查看次数: |
9086 次 |
最近记录: |