IPhone - CLHeading: how can I convert trueHeading to a vector

I know how to get the coordinates of the magnetic header: heading.x, heading.y, heading.z The fact is that I need a (x, y, z) -vector trueHeading. How to create this vector?

Thank!

+3
source share
2 answers

Edit : I changed my answer a bit ...

Basically, you need to rotate the magnetic north vector in the opposite direction to the corner of Magnetic Declination .

The tough part is that you need to rotate the vector on a horizontal plane. To do this, you need to know the orientation of the phone.

Here is what you need to do:

  • Get the vector of magnetic north.

  • Get the gravity vector from the accelerometer.

  • / ( , , ).

  • > X ( -X = ). , - 3D-.

+4

... , , . .

, . , , .

Heading, . , - , , .

- :)

0

All Articles