Skip to content

Instantly share code, notes, and snippets.

@j0shuams
Created Dec 1, 2020
Embed
What would you like to do?
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