tags:

views:

51

answers:

1

How do you calculate the direction that your camera is pointing towards in Android? Azimuth works only if the device is vertical. How do you account for the pitch and roll?

If R is the rotation matrix, I want to find something like:

getRotationMatrix(R, I, grav, mag);
float[] rotated = R {0, 0, -1} ; //not sure how to do matrix multiplication 
float direction = Math.atan(rotated[0]/rotated[1]);
A: 

I would lookup the Accelerometer API. Also, check out this article, it might help: http://www.anddev.org/convert_android_accelerometer_values_and_get_tilt_from_accel-t6595.html

Ricardo Villamil