Added multiplication operator to all vectors

This commit is contained in:
Phyyl 2014-03-17 16:59:09 -04:00
parent 87cfe60b16
commit 617131066a
6 changed files with 86 additions and 2 deletions

View file

@ -1062,6 +1062,19 @@ namespace OpenTK
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector2 operator *(Vector2 vec, Vector2 scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
return vec;
}
/// <summary> /// <summary>
/// Divides the specified instance by a scalar. /// Divides the specified instance by a scalar.
/// </summary> /// </summary>

View file

@ -924,6 +924,19 @@ namespace OpenTK
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector2d operator *(Vector2d vec, Vector2d scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
return vec;
}
/// <summary> /// <summary>
/// Divides an instance by a scalar. /// Divides an instance by a scalar.
/// </summary> /// </summary>

View file

@ -1373,6 +1373,20 @@ namespace OpenTK
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector3 operator *(Vector3 vec, Vector3 scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
vec.Z *= scale.Z;
return vec;
}
/// <summary> /// <summary>
/// Divides an instance by a scalar. /// Divides an instance by a scalar.
/// </summary> /// </summary>

View file

@ -1370,7 +1370,21 @@ namespace OpenTK
vec.Z *= scale; vec.Z *= scale;
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector3d operator *(Vector3d vec, Vector3d scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
vec.Z *= scale.Z;
return vec;
}
/// <summary> /// <summary>
/// Divides an instance by a scalar. /// Divides an instance by a scalar.
/// </summary> /// </summary>

View file

@ -1490,7 +1490,22 @@ namespace OpenTK
vec.W *= scale; vec.W *= scale;
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector4 operator *(Vector4 vec, Vector4 scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
vec.Z *= scale.Z;
vec.W *= scale.W;
return vec;
}
/// <summary> /// <summary>
/// Divides an instance by a scalar. /// Divides an instance by a scalar.
/// </summary> /// </summary>

View file

@ -1493,6 +1493,21 @@ namespace OpenTK
vec.W *= scale; vec.W *= scale;
return vec; return vec;
} }
/// <summary>
/// Component-wise multiplication between the specified instance by a scale vector.
/// </summary>
/// <param name="scale">Left operand.</param>
/// <param name="vec">Right operand.</param>
/// <returns>Result of multiplication.</returns>
public static Vector4d operator *(Vector4d vec, Vector4d scale)
{
vec.X *= scale.X;
vec.Y *= scale.Y;
vec.Z *= scale.Z;
vec.W *= scale.W;
return vec;
}
/// <summary> /// <summary>
/// Divides an instance by a scalar. /// Divides an instance by a scalar.