• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Angle Tangent

Status
Not open for further replies.
Level 23
Joined
Nov 29, 2006
Messages
2,482
I dont know if its because the time is very late, or im just dumb at the moment

The thing you want to do is:
hmhb3.jpg


you want to know the angle a if you have the distance r?
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
well, the vertical x-line is 0 degrees (I think you know that?)

Hm I guess im too tired :Z
What do you want to do?

Yu are aware of the "distance between points" and "angle between points" fuctions right?
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
A tangent will be perpendicular to the angle from the circle. Since it touches the circle at only one point, you first must calculate the angle between the center of the circle and the point where the tangent touches. Since a perpendicular line is the negative reciprocal of the slope of the line it is perpendicular to, the angle should be 90+angle (look below for explanation).
Say you have a tangent that is touching the circle at the right side of the horizontal axis. Well, the angle between where the tangent touches the circle and the middle of the circle is 0, so the line has a slope of 1/0, and Arctangent of 1/0 is 90. As you increase the angle, the slope of the line from the center to the tangent will increase, and thus the reciprocal will decrease, and the Arctangent will increase.
First we need the angle between the two points:
JASS:
Atan2(TangentPointY - CircleCenterY, TangentPointX - CircleCenterX)
Now that we have this angle, in order to get it into degrees, multiply it by bj_RADTODEG. To get your perpendicular, add 90.
Hope this helped,
--donut3.5--
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
oO... I get what you mean...
My tiredness or my dumb lazy brain made me utter nothing

i go back from where I came from... The bed...

Much better having you here explaining, than having me understand 3% of the subjec^t._.
 
Level 12
Joined
Mar 23, 2008
Messages
942
But I'm not using circles...
Oh god, its not that kind of tangent...

Forget, I found this:

If you know the tangent ratio of an angle, finding the unknown angle is called the 'inverse tan' operation, and is often written as: tan-1 or atan.

So: tan 30.96375653° = 0.6
So: tan-1(0.6) = 30.96375653°
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
JASS:
native Atan takes real x returns real
... is there a need to comment ...
P.s. A stands for Archus or something(not sure of exact English translation)
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
If you have the tangent you should use Atan.
To use it in GUI it is in Math - ArcTan(from angle)
Or Custom Script local real angle=Atan (tangent)
Or Custom Script set angle=Atan(tangent)
 
Status
Not open for further replies.
Top