相关疑难解决方法(0)

从Android陀螺仪获取四元数?

官方开发文档提出了以下从3D旋转速率向量获取四元数的方法(wx, wy, wz).

// Create a constant to convert nanoseconds to seconds.
private static final float NS2S = 1.0f / 1000000000.0f;
private final float[] deltaRotationVector = new float[4]();
private float timestamp;

public void onSensorChanged(SensorEvent event) {
  // This timestep's delta rotation to be multiplied by the current rotation
  // after computing it from the gyro sample data.
  if (timestamp != 0) {
    final float dT = (event.timestamp - timestamp) * NS2S;
    // Axis of the rotation sample, …
Run Code Online (Sandbox Code Playgroud)

android quaternions gyroscope

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

gyroscope ×1

quaternions ×1