Question

I've noticed that in several tutorials for using the rotation vector sensor, the mag and accel values are cloned prior to using them in getRotationMatrix.

For example, the code in the question here: Using getRotationMatrix and getOrientation in Android 2.1

However, getRotationMatrix doesn't change the mag and accel vectors. Therefore what is the point of cloning them? Thanks

Was it helpful?

Solution

I think they make that because onSensorChange can change their values (it uses the same variables), so they copy the values first.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top