Pedro,
Java (and pretty much any language's) trig functions work with angles
expressed in radians.
http://en.wikipedia.org/wiki/Radian
To convert to degrees, multiply by 180 / 3,1415926.... (in Java, that's
Math.PI). Or just call Math.toDegrees.
Better yet - use Math.atan2 ( difference along Y, different along X).
This one correctly handles the case of value3-value4 being zero (or very
close thereof).
-- Kostya
15.09.2010 20:22, Pedro Teixeira пишет:
Hi,
I'm having problems with JAva and trigonometry to calculate a
direction from a point to a certain point...
I want to translate this equation to Java-wise:
tg^-1 = |value1-value2| / |value3-value4|
And I'd like the result in degrees.. how can I do this? any ideia?
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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