Created
December 1, 2020 22:00
-
-
Save j0shuams/03cd916bfd6585259f6ba6a74b05fbf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Coords | |
{ | |
public class Coord | |
{ | |
public double X; | |
public double Y; | |
public Coord() | |
{ | |
X = 0.0; | |
Y = 0.0; | |
} | |
public Coord(double x, double y) | |
{ | |
X = x; | |
Y = y; | |
} | |
public double Distance(Coord dest) | |
{ | |
double deltaX = (this.X - dest.X); | |
double deltaY = (this.Y - dest.Y); | |
return Math.Sqrt(deltaX * deltaX + deltaY * deltaY); | |
} | |
public override string ToString() | |
{ | |
return "(" + this.X + "," + this.Y + ")"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment