/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector2 vector, float scale, out Vector2 result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
vec.Y *= scale.Y;
return vec;
}
-
+
/// <summary>
/// Divides the specified instance by a scalar.
/// </summary>
/// <returns>Result of the division.</returns>
public static Vector2 operator /(Vector2 vec, float scale)
{
- float mult = 1.0f / scale;
- vec.X *= mult;
- vec.Y *= mult;
+ vec.X /= scale;
+ vec.Y /= scale;
return vec;
}
/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector2d vector, double scale, out Vector2d result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
vec.Y *= scale.Y;
return vec;
}
-
+
/// <summary>
/// Divides an instance by a scalar.
/// </summary>
/// <returns>The result of the operation.</returns>
public static Vector2d operator /(Vector2d vec, double f)
{
- double mult = 1.0 / f;
- vec.X *= mult;
- vec.Y *= mult;
+ vec.X /= f;
+ vec.Y /= f;
return vec;
}
/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector3 vector, float scale, out Vector3 result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
{
Vector4 result;
- result.X =
- vector.X * worldViewProjection.M11 +
- vector.Y * worldViewProjection.M21 +
- vector.Z * worldViewProjection.M31 +
+ result.X =
+ vector.X * worldViewProjection.M11 +
+ vector.Y * worldViewProjection.M21 +
+ vector.Z * worldViewProjection.M31 +
worldViewProjection.M41;
result.Y =
/// <returns>The result of the calculation.</returns>
public static Vector3 operator /(Vector3 vec, float scale)
{
- float mult = 1.0f / scale;
- vec.X *= mult;
- vec.Y *= mult;
- vec.Z *= mult;
+ vec.X /= scale;
+ vec.Y /= scale;
+ vec.Z /= scale;
return vec;
}
/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector3d vector, double scale, out Vector3d result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
vec.Z *= scale;
return vec;
}
-
+
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
vec.Z *= scale.Z;
return vec;
}
-
+
/// <summary>
/// Divides an instance by a scalar.
/// </summary>
/// <returns>The result of the calculation.</returns>
public static Vector3d operator /(Vector3d vec, double scale)
{
- double mult = 1 / scale;
- vec.X *= mult;
- vec.Y *= mult;
- vec.Z *= mult;
+ vec.X /= scale;
+ vec.Y /= scale;
+ vec.Z /= scale;
return vec;
}
/// <returns>Result of the division</returns>
public static Vector4 Div(Vector4 a, float f)
{
- float mult = 1.0f / f;
- a.X *= mult;
- a.Y *= mult;
- a.Z *= mult;
- a.W *= mult;
+ a.X /= f;
+ a.Y /= f;
+ a.Z /= f;
+ a.W /= f;
return a;
}
/// <param name="result">Result of the division</param>
public static void Div(ref Vector4 a, float f, out Vector4 result)
{
- float mult = 1.0f / f;
- result.X = a.X * mult;
- result.Y = a.Y * mult;
- result.Z = a.Z * mult;
- result.W = a.W * mult;
+ result.X = a.X / f;
+ result.Y = a.Y / f;
+ result.Z = a.Z / f;
+ result.W = a.W / f;
}
#endregion
/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector4 vector, float scale, out Vector4 result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
vec.W *= scale;
return vec;
}
-
+
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <returns>The result of the calculation.</returns>
public static Vector4 operator /(Vector4 vec, float scale)
{
- float mult = 1.0f / scale;
- vec.X *= mult;
- vec.Y *= mult;
- vec.Z *= mult;
- vec.W *= mult;
+ vec.X /= scale;
+ vec.Y /= scale;
+ vec.Z /= scale;
+ vec.W /= scale;
return vec;
}
#endregion
#region Public Members
-
+
/// <summary>
/// Gets or sets the value at the index of the Vector.
/// </summary>
/// <param name="result">Result of the operation.</param>
public static void Divide(ref Vector4d vector, double scale, out Vector4d result)
{
- Multiply(ref vector, 1 / scale, out result);
+ result = vector / scale;
}
/// <summary>
vec.W *= scale;
return vec;
}
-
+
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <returns>The result of the calculation.</returns>
public static Vector4d operator /(Vector4d vec, double scale)
{
- double mult = 1 / scale;
- vec.X *= mult;
- vec.Y *= mult;
- vec.Z *= mult;
- vec.W *= mult;
+ vec.X /= scale;
+ vec.Y /= scale;
+ vec.Z /= scale;
+ vec.W /= scale;
return vec;
}