From 1c4426810c71eead57084be8a18ade8d314dd8c4 Mon Sep 17 00:00:00 2001
From: patrick <patrick.xu@broconcentric.com>
Date: 星期二, 10 十二月 2019 14:24:31 +0800
Subject: [PATCH] 1. 重构项目

---
 src/Bro.Common.Model/Model/CustomizedPoint.cs |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/Bro.Common.Model/Model/CustomizedPoint.cs b/src/Bro.Common.Model/Model/CustomizedPoint.cs
index 942c76b..00bf7cd 100644
--- a/src/Bro.Common.Model/Model/CustomizedPoint.cs
+++ b/src/Bro.Common.Model/Model/CustomizedPoint.cs
@@ -599,4 +599,64 @@
             return data.TrimEnd(new char[] { ',' });
         }
     }
+
+    public class RobotPoint : IComplexDisplay
+    {
+        [Category("鐐逛綅淇℃伅")]
+        [Description("鍧愭爣X")]
+        public float X { get; set; }
+
+        [Category("鐐逛綅淇℃伅")]
+        [Description("鍧愭爣Y")]
+        public float Y { get; set; }
+
+        [Category("鐐逛綅淇℃伅")]
+        [Description("鍧愭爣Z")]
+        public float Z { get; set; }
+
+        [Category("鐐逛綅淇℃伅")]
+        [Description("瑙掑害A")]
+        public float A { get; set; }
+
+        [Category("鐐逛綅淇℃伅")]
+        [Description("瑙掑害B")]
+        public float B { get; set; }
+
+        [Category("鐐逛綅淇℃伅")]
+        [Description("瑙掑害C")]
+        public float C { get; set; }
+
+        public string GetDisplayText()
+        {
+            return $"X:{X.ToString()} Y:{Y.ToString()} Z:{Z.ToString()} A:{A.ToString()} B:{B.ToString()} C:{C.ToString()}";
+        }
+
+        public double[] GetArray()
+        {
+            return new double[] { X, Y, Z, A, B, C };
+        }
+
+        public static RobotPoint GetRobotPointByArray(double[] array)
+        {
+            if (array.Length != 6)
+            {
+                return null;
+            }
+
+            RobotPoint point = new RobotPoint();
+            point.X = (float)array[0];
+            point.Y = (float)array[1];
+            point.Z = (float)array[2];
+            point.A = (float)array[3];
+            point.B = (float)array[4];
+            point.C = (float)array[5];
+
+            return point;
+        }
+
+        public static float GetDistance(RobotPoint pointA, RobotPoint pointB)
+        {
+            return (float)Math.Sqrt(Math.Pow(pointA.X - pointB.X, 2) + Math.Pow(pointA.Y - pointB.Y, 2) + Math.Pow(pointA.Z - pointB.Z, 2));
+        }
+    }
 }

--
Gitblit v1.8.0