2014-06-25 2 views
1

세로로 잡고있는 Android 기기 (예 : Heading)의 제목 (북쪽의 동쪽 또는 서쪽으로 표시)을 찾아야합니다. 지자기 센서에서 반환 된 sensor.event [2] 값에 액세스하여 세로 축을 기준으로 장치를 완전히 회전시킬 때 1에서 35까지 다양하다는 것을 알았습니다. 이 값을 표제로 어떻게 변환 할 수 있습니까? 아주 간단한 설명이나 링크를 부탁드립니다.기기의 제목 찾기

답변

0

SensorManager.getOrientation 살펴보기 3 축을 기준으로 3 개의 각도를 반환합니다.

Computes the device's orientation based on the rotation matrix. 

When it returns, the array values is filled with the result: 

    values[0]: azimuth, rotation around the Z axis. 
    values[1]: pitch, rotation around the X axis. 
    values[2]: roll, rotation around the Y axis. 

The reference coordinate-system used is different from the world coordinate-system defined for the rotation matrix: 

    X is defined as the vector product Y.Z (It is tangential to the ground at the device's current location and roughly points West). 
    Y is tangential to the ground at the device's current location and points towards the magnetic North Pole. 
    Z points towards the center of the Earth and is perpendicular to the ground. 

회전 매트릭스를 얻기 위해 데이터를 입력하려면 지자기 센서와 가속도계 센서를 사용해야합니다. 자세한 정보는 SensorManager를 참조하십시오.