Browse Source

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

大爷 2 years ago
parent
commit
1fbf2e42a0
1 changed files with 18 additions and 0 deletions
  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>