PointExtensions.cs
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using RCS.Model.Comm;
using RCS.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace RCS.WinClient.Common
{
public static class PointExtensions
{
public static bool IsHomePoint(this Base_Point point, Base_Agv agv)
{
return
point.IsStop
|| agv.AgvType == EnumMsg.AgvType.差速
&& point.PointType.In(EnumMsg.PointType.回家点, EnumMsg.PointType.站台点)
&& !point.Barcode.In("2404", "2904")
&& !App.StationList.Any(x=>x.Barcode==point.Barcode&&( x.Name.StartsWith("A02")||x.Name.In("A0101","A0102")));
}
/// <summary>
/// 判断点是否在线段上
/// </summary>
/// <param name="A">线段端点</param>
/// <param name="B">线段端点</param>
/// <param name="P">判断点</param>
/// <param name="tolerance">误差</param>
/// <returns></returns>
public static bool IsOnLineSegment(this Base_Point P, Base_Point A, Base_Point B, double tolerance = 5)
{
var distance = ComnMethod.GetPointDistanceToLineSegment(A, B, P);
// 判断距离是否在误差范围内
return distance <= tolerance;
}
}
}