浏览代码

增加了几个接口@Vector3给客户端用

大爷 2 年之前
父节点
当前提交
1fbf2e42a0
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      Common/CommonLang/Geometry/Vector3.cs

+ 18 - 0
Common/CommonLang/Geometry/Vector3.cs

@@ -200,6 +200,19 @@ namespace CommonLang.Geometry
         
         #region Public Methods
 
+        public void Set(float x, float y, float z)
+        {
+            this.X = x;
+            this.Y = y;
+            this.Z = z;
+        }
+        public void Set(Vector3 vec)
+        {
+            this.X = vec.X;
+            this.Y = vec.Y;
+            this.Z = vec.Z;
+        }
+
         /// <summary>
         /// Performs vector addition on <paramref name="value1"/> and <paramref name="value2"/>.
         /// </summary>
@@ -509,6 +522,11 @@ namespace CommonLang.Geometry
                     Z == other.Z;
         }
 
+        public bool Equal(Vector3 other, float precision)
+        {
+            return Math.Abs(X - other.X) < precision && Math.Abs(Y - other.Y) < precision && Math.Abs(Z - other.Z) < precision;
+        }
+
         /// <summary>
         /// Gets the hash code of this <see cref="Vector3"/>.
         /// </summary>