Skip to content

Commit

Permalink
Fix overflow when calculating very long distances
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Jun 14, 2024
1 parent aa3e1e5 commit 507a728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GameServer/Geometry/Vector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public struct Vector
public int Y { get; init; }
public int Z { get; init; }

public double Length => Math.Sqrt(X * X + Y * Y + Z * Z);
public double Length2D => Math.Sqrt(X * X + Y * Y);
public double Length => Math.Sqrt((double)X * X + (double)Y * Y + (double)Z * Z);
public double Length2D => Math.Sqrt((double)X * X + (double)Y * Y);
public Angle Orientation => Angle.Radians(-Math.Atan2(X,Y));

public static Vector Create(int x = 0, int y = 0, int z = 0)
Expand Down

0 comments on commit 507a728

Please sign in to comment.