Angle Between Points

Klein~

TH.net Regular
Reaction score
0
How is it calc?

I'm assuming one line that pass over the points and by making one horizontal/vertical line over both the points you can see the angle of x and y and the diferençe of them. Am I right?
 

Solu9

You can change this now in User CP.
Reaction score
216
Variables

Point_A = position of casting unit
Point_B = position of ability being cast
Integer_A = angle between Point_A and Point_B

An example :)
 

Klein~

TH.net Regular
Reaction score
0
I understand how to apply it but I wanted to know how the game mechanism calculates this.

I found out one way to check and it works as:

X and Y are points in the map. If you want the angle between X and Y, it will display the direction of the distance vector of XY, let's say it's 45. But, if you want the angle between Y and X, it will display the save direction but opposed, so the angle will be -135 for the example.
 

Imp Midna

Active Member
Reaction score
52
JASS:
//===========================================================================
function AngleBetweenPoints takes location locA, location locB returns real
    return bj_RADTODEG * Atan2(GetLocationY(locB) - GetLocationY(locA), GetLocationX(locB) - GetLocationX(locA))
endfunction
//===========================================================================

in english:
Given the Points A and B, the function calculates the angle in signed degrees (-180-180) between the vector AB and the positive x-axis (in WC3, the axis pointin to the right), just as we learned in school (cos(angle)=(DotP(AB,OX))/(|AB|*|OX|) if i remember correctly). The name "angle between points" is missleading as there obviously can not be an angle between to points (like.... It feels so wrong)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top