Warcraft III resources & community, 2003–2006 · archived

calculating distance using the trigonometric functions?

4 posts
#1

calculating distance using the trigonometric functions?

not sure, but it seems to me youd have to set a point matching the x value of 1 point and the y value of the other point to make a triangle and then use an x-x kind of thing to detect 1 of the distances of 1 of the sides and then use sin/cos functions to make it detect distance.

but my mind isnt working right now, so if any1 could explain how to make the trigger...pls :(
#2
you didnt even explain what you want!
#3
I don't understand what your after but here is a trigonometic formla for distance if you know the X1 , X2, Y1 and Y2.

(Y2-Y1)/sin(Atan((Y2-Y1) - (X2-X1))
It calculates the C line in a triangle like Pytagars's formula, without square root. However this formula is much slower than Pytagora's so don't use it. I just made it to see if it was faster but it wasn't.
#4
wait, yah edit: just realised, i can just used pythagorean theorum before i checked thread. thx anyway. (told u my mind wuznt werking)