Angle!

Ok, i get this example working on my plane game, i receive East -180 to East +180 degrees, still,

im after North +0 to North +360 degrees at on my game, is there any matematical solution with Java for North 0 to North 360 angles.

or, do i do tricks, like a i did on my first post ??

-----

Thanks..

The result above makes East = 0.

If you want North to be 0, East effectively becomes -90.

That means, add 90 to the value returned.

The result above gives you a value from -180 to 180 (where 0 is east).

If you want to make it 0 to 360, effectively everything is 180 more.

That means, add 180 to the value returned.

We want to do both.

Let's convert it into an equation.

1 2 3 4 5 6 7 8
| public double convertToNorth(double angle) { return angle + 90; } public double convertTo360(double angle) { return angle + 180; } |

Doing both means you've got to convert it to 360 and then make sure 0 is considered north. That means:

1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public double doBoth(double angle) { angle = convertTo360(angle);
angle = convertToNorth(angle);
return angle; } |

Make sense yet? What's the final result? That's right. Add 270.