angles of a triangle

Grymlax

Probably not around
Reaction score
138
how do i check the angles of a triangle consisting of three points.

for example lets say we have three units standing on the map creating a triangle (stading on each corner). how would i do to check the angle of (A)
triangle.gif
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Get the angle between points, meaning let's say the 3 units are A B and C.

Get the angle between A and C, A and B. Then subtract the values.

Say north is 0 degrees(increasing in clockwise direction),
A is west of B,
A is directly southwest of C.

Angle between A and B is 90 degrees
Angle between A and C is 45 degrees
90 - 45 = 45 degrees so this is the angle.

Though, this is untested..
 

Trollvottel

never aging title
Reaction score
262
for this you normally calculate the raising of the hypothenuse (dx/dy) and use Atan(raising).
But since we are working with wc3, you should use Atan2(dy, dx), otherwise the angles will not range from -180 to 180 but from -90 to 90 (because for the tangent function it makes no difference wether you use (dx/-dy or -dx/dy) on the one side or (dx/dy or -dx/-dy) on the other side).

so just get the deltaX and deltaY by substraction the X and Y of the single units and then use the Atan2 function.


PS: angles are written with greek letters, Capital letters are used for points.
 
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