using System.Windows; namespace Serein.Workbench.Extension { /// /// 点(Point)和向量(Vector)的扩展方法 /// public static class PointExtension { /// /// 将两个点相加,返回一个新的点。 /// /// /// /// public static Point Add(this Point a, Point b) { return new Point(a.X + b.X, a.Y + b.Y); } /// /// 将两个点相减,返回一个新的点。 /// /// /// /// public static Point Sub(this Point a, Point b) { return new Point(a.X - b.X, a.Y - b.Y); } /// /// 将点转换为向量。 /// /// /// public static Vector ToVector(this Point me) { return new Vector(me.X, me.Y); } } }