namespace TraceCad.Core.Geometry;

public readonly record struct Point2(double X, double Y)
{
    public static Point2 Origin { get; } = new(0.0, 0.0);

    public double DistanceTo(Point2 other) => (this - other).Length;

    public static Point2 operator +(Point2 point, Vector2 vector) =>
        new(point.X + vector.X, point.Y + vector.Y);

    public static Point2 operator -(Point2 point, Vector2 vector) =>
        new(point.X - vector.X, point.Y - vector.Y);

    public static Vector2 operator -(Point2 left, Point2 right) =>
        new(left.X - right.X, left.Y - right.Y);
}
