mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-11 04:00:47 +08:00
1. Workben项目中,优化了Node的入参类型与返回类型包含泛型成员的类型显示。
This commit is contained in:
42
Workbench/Extension/PointExtension.cs
Normal file
42
Workbench/Extension/PointExtension.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Serein.Workbench.Extension
|
||||
{
|
||||
/// <summary>
|
||||
/// 点(Point)和向量(Vector)的扩展方法
|
||||
/// </summary>
|
||||
public static class PointExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 将两个点相加,返回一个新的点。
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static Point Add(this Point a, Point b)
|
||||
{
|
||||
return new Point(a.X + b.X, a.Y + b.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将两个点相减,返回一个新的点。
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static Point Sub(this Point a, Point b)
|
||||
{
|
||||
return new Point(a.X - b.X, a.Y - b.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将点转换为向量。
|
||||
/// </summary>
|
||||
/// <param name="me"></param>
|
||||
/// <returns></returns>
|
||||
public static Vector ToVector(this Point me)
|
||||
{
|
||||
return new Vector(me.X, me.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user