How to calculate ios accelerometer horizontal plane
I am working on an IOS AR project, now i 've done with Camera, GPS with altitude, Compass heading but i can not get the right vector of gravity to draw the right horizontal plane. Please help me with my problem. - Calculate horizontal plane and draw on the camera view. (And w开发者_JAVA百科ith altitude will be so good) - Maybe project wll help me a lot.
Please help. Thanks you very much.
Record some filtered accelerometer samples while not moving the device.
Compute the average of all those samples to get the down vector.
Vectors perpendicular to it make up the horizontal planes. Taking the dot product of the down vector with a vector along the Z axis (0,0,1) would allow you to figure out the angle of the screen relative to the horizon (see accelerometer axes)
I haven't tried this, but that would be my approach... hope it helps somehow
精彩评论