28 lines
884 B
C#
28 lines
884 B
C#
using System;
|
|
|
|
namespace Assets.Common
|
|
{
|
|
public class Point
|
|
{
|
|
public double x;
|
|
public double y;
|
|
|
|
public Point(double x, double y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public static double Dist(Point a, Point b)
|
|
{
|
|
return Math.Sqrt(Math.Pow(a.x - b.x, 2) + Math.Pow(a.y - b.y, 2));
|
|
}
|
|
|
|
public static Point operator +(Point a, Point b) => new Point(a.x + b.x, a.y + b.y);
|
|
public static Point operator +(Point a) => a;
|
|
public static Point operator -(Point a, Point b) => new Point(a.x - b.x, a.y - b.y);
|
|
public static Point operator -(Point a) => new Point(-a.x, -a.y);
|
|
public static Point operator *(Point a, double b) => new Point(a.x * b, a.y * b);
|
|
public static Point operator /(Point a, double b) => new Point(a.x / b, a.y / b);
|
|
}
|
|
} |