Hi all,

I spend two weeks now trying to get this working with no success. Here
is what I want to do:

I have several geo points around the user and his phone. I want to
display this point overlaying them on the input from the camera (kind
of standard AR (Augmented Reality) app). Part of my requirements are
that the user can use the phone in either landscape or portrait mode.

My plan was like this.

1. Register for Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD
2. Pass the result to SensorManager.getRotationMatrix(), getting back
the R matrix that should be telling me how to translate points from
the Phone coordinate system (defined here:
http://developer.android.com/reference/android/hardware/SensorEvent.html)
to World coordinate system (x -> East, y -> North, z -> Sky)
3. I want to translate points from World to Phone so I take the
inverse of R (I'm using Matrix.invertM()) to get R_In
4. Using the GPS I translate the geo points I want to display on the
camera to points in the World coordinate system and then I run them
through the R_In matrix to get their coordinates in the Phone system.
5. Draw the points in the screen only if the have (phone coordinates)
z < 0 and x and y such that they are visible...

This is my grand plan... however I have problems quite early (2). I do
get the R matrix back and it looks good when I align the phone to the
world coordinate system ( I get the identity matrix ). However when I
try to translate an imaginary point from the Phone coordinate system
say (0, 1, 0) to the World coordinate system I don't get the numbers I
expect.

For example when i expect (1, 0, 0) i get (-1, 0, 0)
when i expect (0, 0, 1) i get (0, 0, -1)

I haven't done any remapping of the coordinate system and I feel I
don't need too...
Is this the right approach? Any suggestions for me?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to