• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

calculating distance using the trigonometric functions?

Status
Not open for further replies.
Level 4
Joined
May 17, 2005
Messages
94
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 :(
 
Level 12
Joined
Apr 29, 2005
Messages
999
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.
 
Status
Not open for further replies.
Top