/// <summary> /// Constructor. /// </summary> /// <param name="vector"> Initial vector. </param> public Vector3F(Vector3F vector) { this.X = vector.X; this.Y = vector.Y; this.Z = vector.Z; }
/// <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 float GetSquareDistance(Vector3F vector) { return MathUtils.Pow2(vector.X - this.X) + MathUtils.Pow2(vector.Y - this.Y) + MathUtils.Pow2(vector.Z - this.Z); }
/// <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 Vector3F Min(Vector3F lhs, Vector3F rhs) { return new Vector3F(MathUtils.Min(lhs.X, rhs.X), MathUtils.Min(lhs.Y, rhs.Y), MathUtils.Min(lhs.Z, rhs.Z)); }
/// <summary> /// Determines whether the specified <see cref="Vector3F" /> is equal to the current <see cref="Vector3F" />. /// </summary> /// <returns> /// true if the specified <see cref="Vector3F" /> is equal to the current <see cref="Vector3F" />; otherwise, false. /// </returns> /// <param name="other"> /// The <see cref="Vector3F" /> to compare with the current <see cref="Vector3F" />. /// </param> public bool Equals(Vector3F other) { return this.X.Equals(other.X) && this.Y.Equals(other.Y) && this.Z.Equals(other.Z); }
/// <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(Vector3F vector) { return MathUtils.Sqrt(this.GetSquareDistance(vector)); }
/// <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 float CalculateDotProduct(Vector3F vector) { return Dot(this, vector); }
/// <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 float Dot(Vector3F a, Vector3F b) { return (a.X * b.X) + (a.Y * b.Y) + (a.Z * b.Z); }
/// <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 Vector3F Min(Vector3F lhs, Vector3F rhs) { return(new Vector3F(MathUtils.Min(lhs.X, rhs.X), MathUtils.Min(lhs.Y, rhs.Y), MathUtils.Min(lhs.Z, rhs.Z))); }
/// <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 float GetSquareDistance(Vector3F vector) { return(MathUtils.Pow2(vector.X - this.X) + MathUtils.Pow2(vector.Y - this.Y) + MathUtils.Pow2(vector.Z - this.Z)); }
/// <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(Vector3F vector) { return(MathUtils.Sqrt(this.GetSquareDistance(vector))); }
/// <summary> /// Determines whether the specified <see cref="Vector3F" /> is equal to the current <see cref="Vector3F" />. /// </summary> /// <returns> /// true if the specified <see cref="Vector3F" /> is equal to the current <see cref="Vector3F" />; otherwise, false. /// </returns> /// <param name="other"> /// The <see cref="Vector3F" /> to compare with the current <see cref="Vector3F" />. /// </param> public bool Equals(Vector3F other) { return(this.X.Equals(other.X) && this.Y.Equals(other.Y) && this.Z.Equals(other.Z)); }
/// <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 float Dot(Vector3F a, Vector3F b) { return((a.X * b.X) + (a.Y * b.Y) + (a.Z * b.Z)); }
/// <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 float CalculateDotProduct(Vector3F vector) { return(Dot(this, vector)); }