Skip to content

Commit

Permalink
Add methods for scaling 4x4 matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
HamletTanyavong committed Dec 5, 2023
1 parent 1c899e4 commit 32601b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Mathematics.NET/LinearAlgebra/Matrix4x4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,30 @@ readonly get
return result;
}

public static Matrix4x4<T> operator *(T c, Matrix4x4<T> matrix)
{
Unsafe.SkipInit(out Matrix4x4<T> result);

result.X1 = c * matrix.X1;
result.X2 = c * matrix.X2;
result.X3 = c * matrix.X3;
result.X4 = c * matrix.X4;

return result;
}

public static Matrix4x4<T> operator *(Matrix4x4<T> matrix, T c)
{
Unsafe.SkipInit(out Matrix4x4<T> result);

result.X1 = matrix.X1 * c;
result.X2 = matrix.X2 * c;
result.X3 = matrix.X3 * c;
result.X4 = matrix.X4 * c;

return result;
}

//
// Equality
//
Expand Down

0 comments on commit 32601b3

Please sign in to comment.