コード例 #1
0
 /// <summary>
 ///   Returns a vector that is made from the smallest components of two vectors.
 /// </summary>
 /// <param name="lhs"> First vector. </param>
 /// <param name="rhs"> Second vector. </param>
 /// <returns>Vector that is made from the smallest components of two vectors.</returns>
 public static Vector3I Min(Vector3I lhs, Vector3I rhs)
 {
     return new Vector3I(MathUtils.Min(lhs.X, rhs.X), MathUtils.Min(lhs.Y, rhs.Y), MathUtils.Min(lhs.Z, rhs.Z));
 }
コード例 #2
0
 /// <summary>
 ///   Constructor.
 /// </summary>
 /// <param name="vector"> Initial vector. </param>
 public Vector3I(Vector3I vector)
 {
     this.X = vector.X;
     this.Y = vector.Y;
     this.Z = vector.Z;
 }
コード例 #3
0
 /// <summary>
 ///   Calculates the square distance between this and the passed vector.
 /// </summary>
 /// <param name="vector"> Vector to compute square distance to. </param>
 /// <returns> Square distance between this and the passed vector. </returns>
 public int GetSquareDistance(Vector3I vector)
 {
     return MathUtils.Pow2(vector.X - this.X) + MathUtils.Pow2(vector.Y - this.Y)
            + MathUtils.Pow2(vector.Z - this.Z);
 }
コード例 #4
0
 /// <summary>
 ///   Calculates the distance between this and the passed vector.
 /// </summary>
 /// <param name="vector"> Vector to compute distance to. </param>
 /// <returns> Distance between this and the passed vector. </returns>
 public float GetDistance(Vector3I vector)
 {
     return MathUtils.Sqrt(this.GetSquareDistance(vector));
 }
コード例 #5
0
 /// <summary>
 ///   Determines whether the specified <see cref="Vector3I" /> is equal to the current <see cref="Vector3I" />.
 /// </summary>
 /// <returns>
 ///   true if the specified <see cref="Vector3I" /> is equal to the current <see cref="Vector3I" />; otherwise, false.
 /// </returns>
 /// <param name="other">
 ///   The <see cref="Vector3I" /> to compare with the current <see cref="Vector3I" />.
 /// </param>
 public bool Equals(Vector3I other)
 {
     return this.X == other.X && this.Y == other.Y && this.Z == other.Z;
 }
コード例 #6
0
 /// <summary>
 ///   Calculates the dot product of the two passed vectors. See http://en.wikipedia.org/wiki/Dot_product for more details.
 /// </summary>
 /// <param name="a"> First vector. </param>
 /// <param name="b"> Second vector. </param>
 /// <returns> Dot product of the two passed vectors. </returns>
 public static int Dot(Vector3I a, Vector3I b)
 {
     return (a.X * b.X) + (a.Y * b.Y) + (a.Z * b.Z);
 }
コード例 #7
0
 /// <summary>
 ///   Calculates the dot product of this and the passed vector. See http://en.wikipedia.org/wiki/Dot_product for more
 ///   details.
 /// </summary>
 /// <param name="vector"> Vector to calculate dot product with. </param>
 /// <returns> Dot product of this and the passed vector. </returns>
 public int CalculateDotProduct(Vector3I vector)
 {
     return Dot(this, vector);
 }