Skip to content

Commit

Permalink
CHEAP_HYPOTENUSE() no longer makes the differences between the coordi…
Browse files Browse the repository at this point in the history
…nates absolute. (tgstation#82468)

## About The Pull Request
CHEAP_HYPOTENUSE() no longer absolutes the differences between the
coordinates.
## Why It's Good For The Game
It gets squared so it doesn't need to be done.
  • Loading branch information
Pickle-Coding authored Apr 6, 2024
1 parent 34890b9 commit a72db18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@

//We used to use linear regression to approximate the answer, but Mloc realized this was actually faster.
//And lo and behold, it is, and it's more accurate to boot.
#define CHEAP_HYPOTENUSE(Ax, Ay, Bx, By) (sqrt(abs(Ax - Bx) ** 2 + abs(Ay - By) ** 2)) //A squared + B squared = C squared
#define CHEAP_HYPOTENUSE(Ax, Ay, Bx, By) (sqrt((Ax - Bx) ** 2 + (Ay - By) ** 2)) //A squared + B squared = C squared

/// The number of cells in a taxicab circle (rasterized diamond) of radius X.
#define DIAMOND_AREA(X) (1 + 2*(X)*((X)+1))
Expand Down

0 comments on commit a72db18

Please sign in to comment.