public static InverseSqrtFast ( double x ) : double | ||
x | double | A number. |
return | double |
/// <summary> /// Scales the Vector4d to approximately unit length. /// </summary> public void NormalizeFast() { double scale = MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z + W * W); X *= scale; Y *= scale; Z *= scale; W *= scale; }
/// <summary> /// Scale a vector to approximately unit length /// </summary> /// <param name="vec">The input vector</param> /// <returns>The normalized vector</returns> public static Vector3 NormalizeFast(Vector3 vec) { float scale = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z); vec.X *= scale; vec.Y *= scale; vec.Z *= scale; return(vec); }
/// <summary> /// Scale a vector to approximately unit length /// </summary> /// <param name="vec">The input vector</param> /// <param name="result">The normalized vector</param> public static void NormalizeFast(ref Vector4 vec, out Vector4 result) { float scale = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z + vec.W * vec.W); result.X = vec.X * scale; result.Y = vec.Y * scale; result.Z = vec.Z * scale; result.W = vec.W * scale; }
public static void NormalizeFast(ref Vector4d vec, out Vector4d result) { double num = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z + vec.W * vec.W); result.X = vec.X * num; result.Y = vec.Y * num; result.Z = vec.Z * num; result.W = vec.W * num; }
public void NormalizeFast() { double num = MathHelper.InverseSqrtFast(this.X * this.X + this.Y * this.Y + this.Z * this.Z + this.W * this.W); this.X *= num; this.Y *= num; this.Z *= num; this.W *= num; }
public static Vector3 NormalizeFast(Vector3 vec) { float num = MathHelper.InverseSqrtFast((float)((double)vec.X * (double)vec.X + (double)vec.Y * (double)vec.Y + (double)vec.Z * (double)vec.Z)); vec.X *= num; vec.Y *= num; vec.Z *= num; return(vec); }
public static void NormalizeFast(ref Vector4 vec, out Vector4 result) { float num = MathHelper.InverseSqrtFast((float)((double)vec.X * (double)vec.X + (double)vec.Y * (double)vec.Y + (double)vec.Z * (double)vec.Z + (double)vec.W * (double)vec.W)); result.X = vec.X * num; result.Y = vec.Y * num; result.Z = vec.Z * num; result.W = vec.W * num; }
public void NormalizeFast() { float num = MathHelper.InverseSqrtFast((float)((double)this.X * (double)this.X + (double)this.Y * (double)this.Y + (double)this.Z * (double)this.Z + (double)this.W * (double)this.W)); this.X *= num; this.Y *= num; this.Z *= num; this.W *= num; }
/// <summary> /// Scale a vector to approximately unit length /// </summary> /// <param name="vec">The input vector</param> /// <returns>The normalized vector</returns> public static Vector4d NormalizeFast(Vector4d vec) { double scale = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z + vec.W * vec.W); vec.X *= scale; vec.Y *= scale; vec.Z *= scale; vec.W *= scale; return(vec); }
public static double InverseSqrtFast(double x) { return((double)MathHelper.InverseSqrtFast((float)x)); }