Argh, late night programming wastes so much dev time! To get 360
degrees instead of - 180 to 180, simply add 360 to the value if its
negative as so.

                                if (values[0] <= 0) {
                                        one1 = Math.toDegrees(values[0]);
                                        one1 = one1 + 360;
                                } else {
                                        one1 = Math.toDegrees(values[0]);
                                }

George


On Jul 21, 12:54 am, Fuzzmonkey <[email protected]> wrote:
> Thanks Rud for your posts / blog entry. Helped me out allot! This may
> be a stupid question but how do i get azimuth value returned from
> getOrientation to go 0 - 360 degrees rather -180 to 180 degrees? Is
> there something i'm missing? Im using code very similar to the code
> you posted on your blog, but im using the java math.todegrees()
> function to convert from radians and have no digital filter
> implemented.
>
> Tend to miss out vital bits of code when working in the early hours of
> the morning!
>
> Thanks,
>
> George
>
> On Jul 12, 6:44 am, Rud <[email protected]> wrote:
>
> > I did some testing on the compass direction and the results are, eh,
> > interesting.
>
> > I compared the readings I was getting with the Google Sky Map and they
> > were basically the same. Here is what I did.
>
> > With both my app and SkyMap I had the phone in camera position. I
> > positioned the phone on a piece of paper and drew a line on along the
> > side in contact with the paper. I did this for N, E, W, & S. As I
> > said, the lines from my app agreed with the ones from Sky Map.
>
> > I drew a N/S line using a physical compass. The lines for N & S were
> > rotated a bit clockwise from being right angles to the N/S line. The E/
> > W lines were both skewed even more clockwise from the N/S line. [Yeah,
> > I've calibrated the phone doing figure 8's and flipping it while
> > rotating it, etc.] It also appears that the sensors expect the phone
> > to be in camera position, i.e. left side down, because when the right
> > side is down all the compass points are even worse.
>
> > I'd be curious to see if other phones get similar results.
>
> > Rudhttp://mysticlakesoftware.blogspot.com/
>
>
--~--~---------~--~----~------------~-------~--~----~
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