/// <summary> /// Clamp the each component to specified min and max. /// </summary> public void Clamp(Vector3f min, Vector3f max) { x = Math.Max(Math.Min(x, max.x), min.x); y = Math.Max(Math.Min(y, max.y), min.y); z = Math.Max(Math.Min(z, max.z), min.z); }
/// <summary> /// Create a rotation out of a vector. /// </summary> static public Matrix4x4f Rotate(Vector3f euler) { return(Quaternion3f.FromEuler(euler).ToMatrix4x4f()); }
/// <summary> /// The minimum value between each component in vectors. /// </summary> public void Min(Vector3f v) { x = Math.Min(x, v.x); y = Math.Min(y, v.y); z = Math.Min(z, v.z); }
/// <summary> /// The maximum value between each component in vectors. /// </summary> public void Max(Vector3f v) { x = Math.Max(x, v.x); y = Math.Max(y, v.y); z = Math.Max(z, v.z); }
/// <summary> /// Distance between two vectors. /// </summary> public static float Distance(Vector3f v0, Vector3f v1) { return(FMath.SafeSqrt(SqrDistance(v0, v1))); }
/// <summary> /// Cross two vectors. /// </summary> public static Vector3f Cross(Vector3f v0, Vector3f v1) { return(new Vector3f(v0.y * v1.z - v0.z * v1.y, v0.z * v1.x - v0.x * v1.z, v0.x * v1.y - v0.y * v1.x)); }
/// <summary> /// Cross two vectors. /// </summary> public Vector3f Cross(Vector3f v) { return(new Vector3f(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x)); }
/// <summary> /// The dot product of two vectors. /// </summary> public static float Dot(Vector3f v0, Vector3f v1) { return(v0.x * v1.x + v0.y * v1.y + v0.z * v1.z); }
/// <summary> /// Are these vectors equal. /// </summary> public bool Equals(Vector3f v) { return(this == v); }