Skip to content

Instantly share code, notes, and snippets.

@j0shuams
Created December 1, 2020 22:00
Show Gist options
  • Save j0shuams/03cd916bfd6585259f6ba6a74b05fbf1 to your computer and use it in GitHub Desktop.
Save j0shuams/03cd916bfd6585259f6ba6a74b05fbf1 to your computer and use it in GitHub Desktop.
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