Skip to content

Commit 1fc3e6b

Browse files
authored
Fix copy-pase typos in Silk.NET.Math that were discovered during the exploration for Math 3.0. (#2469)
* Fix copy-pase typos in Silk.NET.Math that were discovered during the exploration for Math 3.0. * Reinclude removed APIs. * A couple more that were missed initially.
1 parent c0dbe83 commit 1fc3e6b

File tree

20 files changed

+51
-44
lines changed

20 files changed

+51
-44
lines changed

src/Maths/Silk.NET.Maths/Cube.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public bool Contains(Cube<T> other)
121121
return Scalar.GreaterThanOrEqual(other.Origin.X, this.Origin.X) && Scalar.GreaterThanOrEqual
122122
(other.Origin.Y, this.Origin.Y) && Scalar.GreaterThanOrEqual
123123
(other.Origin.Z, this.Origin.Z) && Scalar.LessThanOrEqual(oMax.X, tMax.X) && Scalar.LessThanOrEqual
124-
(oMax.Y, tMax.Y) && Scalar.GreaterThanOrEqual(oMax.Y, tMax.Y);
124+
(oMax.Y, tMax.Y) && Scalar.LessThanOrEqual(oMax.Y, tMax.Y);
125125
}
126126

127127
/// <summary>
@@ -240,4 +240,4 @@ public Cube<TOther> As<TOther>() where TOther : unmanaged, IFormattable, IEquata
240240
return new(Origin.As<TOther>(), Max.As<TOther>());
241241
}
242242
}
243-
}
243+
}

src/Maths/Silk.NET.Maths/Matrix2X2.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public struct Matrix2X2<T> : IEquatable<Matrix2X2<T>>
2222
/// </summary>
2323
[IgnoreDataMember]
2424
public Vector2D<T> Row1;
25+
2526
/// <summary>
2627
/// Row 2 of the matrix.
2728
/// </summary>
@@ -40,7 +41,6 @@ public struct Matrix2X2<T> : IEquatable<Matrix2X2<T>>
4041
[IgnoreDataMember]
4142
public Vector2D<T> Column2 => new(M12, M22);
4243

43-
4444
/// <summary>Value at row 1, column 1 of the matrix.</summary>
4545
[DataMember]
4646
public T M11
@@ -130,8 +130,8 @@ public Matrix2X2(Matrix3X2<T> value)
130130
Row2 = new(value.M21, value.M22);
131131
}
132132

133-
/// <summary>Constructs a <see cref="Matrix2X2{T}"/> from the given Matrix4x3.</summary>
134-
/// <param name="value">The source Matrix4x3.</param>
133+
/// <summary>Constructs a <see cref="Matrix2X2{T}"/> from the given <see cref="Matrix4X3{T}"/>.</summary>
134+
/// <param name="value">The source <see cref="Matrix4X3{T}"/>.</param>
135135
public Matrix2X2(Matrix4X3<T> value)
136136
{
137137
Row1 = new(value.M11, value.M12);
@@ -166,6 +166,7 @@ public Matrix2X2(Matrix4X2<T> value)
166166
public static Matrix2X2<T> Identity => _identity;
167167

168168
/// <summary>Returns whether the matrix is the identity matrix.</summary>
169+
[IgnoreDataMember]
169170
public readonly bool IsIdentity
170171
=> Scalar.Equal(M11, Scalar<T>.One) &&
171172
Scalar.Equal(M22, Scalar<T>.One) && // Check diagonal element first for early out.
@@ -225,7 +226,7 @@ public readonly bool IsIdentity
225226
/// <returns>The result of the multiplication.</returns>
226227
public static unsafe Vector2D<T> operator *(Vector2D<T> value1, Matrix2X2<T> value2)
227228
{
228-
return value1 * value2.Row1 + value1 * value2.Row2;
229+
return value1.X * value2.Row1 + value1.Y * value2.Row2;
229230
}
230231

231232
/// <summary>Multiplies a matrix by a scalar value.</summary>

src/Maths/Silk.NET.Maths/Matrix2X3.Ops.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static Matrix2X3<T> Subtract<T>(Matrix2X3<T> value1, Matrix2X3<T> value2)
216216
public static unsafe Matrix2X3<T> Lerp<T>(Matrix2X3<T> matrix1, Matrix2X3<T> matrix2, T amount)
217217
where T : unmanaged, IFormattable, IEquatable<T>, IComparable<T>
218218
{
219-
return new(Vector3D.Lerp(matrix1.Row1, matrix2.Row2, amount), Vector3D.Lerp(matrix1.Row2, matrix2.Row2, amount));
219+
return new(Vector3D.Lerp(matrix1.Row1, matrix2.Row1, amount), Vector3D.Lerp(matrix1.Row2, matrix2.Row2, amount));
220220
}
221221

222222
/// <summary>Transforms the given matrix by applying the given Quaternion rotation.</summary>
@@ -260,4 +260,4 @@ public static Matrix2X3<T> Transform<T>(Matrix2X3<T> value, Quaternion<T> rotati
260260
return new(value.M11 * q1 + value.M12 * q2 + value.M13 * q3, value.M21 * q1 + value.M22 * q2 + value.M23 * q3);
261261
}
262262
}
263-
}
263+
}

src/Maths/Silk.NET.Maths/Matrix2X3.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public T M13
7878
[DataMember]
7979
public T M21
8080
{
81-
readonly get => Row1.X;
82-
set => Row1.X = value;
81+
readonly get => Row2.X;
82+
set => Row2.X = value;
8383
}
8484

8585
/// <summary>Value at row 2, column 2 of the matrix.</summary>

src/Maths/Silk.NET.Maths/Matrix2X4.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void VerifyBounds(int i)
156156
}
157157

158158
/// <summary>
159-
/// Constructs a <see cref="Matrix2X4{T}"/> from the given rows
159+
/// Constructs a <see cref="Matrix2X4{T}"/> from the given rows.
160160
/// </summary>
161161
public Matrix2X4(Vector4D<T> row1, Vector4D<T> row2)
162162
{
@@ -179,8 +179,8 @@ public Matrix2X4(Matrix3X2<T> value)
179179
Row2 = new(value.M21, value.M22, default, default);
180180
}
181181

182-
/// <summary>Constructs a <see cref="Matrix2X4{T}"/> from the given Matrix4x3.</summary>
183-
/// <param name="value">The source Matrix4x3.</param>
182+
/// <summary>Constructs a <see cref="Matrix2X4{T}"/> from the given <see cref="Matrix4X3{T}"/>.</summary>
183+
/// <param name="value">The source <see cref="Matrix4X3{T}"/>.</param>
184184
public Matrix2X4(Matrix4X3<T> value)
185185
{
186186
Row1 = new(value.M11, value.M12, value.M13, default);
@@ -203,7 +203,7 @@ public Matrix2X4(Matrix3X3<T> value)
203203
Row2 = new(value.M21, value.M22, value.M23, default);
204204
}
205205

206-
/// <summary>Constructs a Matrix2x4 from the given <see cref="Matrix4X2{T}"/>.</summary>
206+
/// <summary>Constructs a <see cref="Matrix2X4{T}"/> from the given <see cref="Matrix4X2{T}"/>.</summary>
207207
/// <param name="value">The source <see cref="Matrix4X2{T}"/>.</param>
208208
public Matrix2X4(Matrix4X2<T> value)
209209
{

src/Maths/Silk.NET.Maths/Matrix3X2.Ops.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,15 @@ public static Matrix2X3<T> Multiply<T>(Matrix2X3<T> value1, Matrix3X3<T> value2)
471471
where T : unmanaged, IFormattable, IEquatable<T>, IComparable<T>
472472
=> value1 * value2;
473473

474+
/// <summary>Multiplies two matrices together and returns the resulting matrix.</summary>
475+
/// <param name="value1">The first source matrix.</param>
476+
/// <param name="value2">The second source matrix.</param>
477+
/// <returns>The product matrix.</returns>
478+
[MethodImpl((MethodImplOptions) 768)]
479+
public static Matrix3X2<T> Multiply<T>(Matrix3X3<T> value1, Matrix3X2<T> value2)
480+
where T : unmanaged, IFormattable, IEquatable<T>, IComparable<T>
481+
=> value1 * value2;
482+
474483
/// <summary>Scales all elements in a matrix by the given scalar factor.</summary>
475484
/// <param name="value1">The source matrix.</param>
476485
/// <param name="value2">The scaling value to use.</param>
@@ -497,4 +506,4 @@ public static Matrix3X2<T> Subtract<T>(Matrix3X2<T> value1, Matrix3X2<T> value2)
497506
where T : unmanaged, IFormattable, IEquatable<T>, IComparable<T>
498507
=> value1 - value2;
499508
}
500-
}
509+
}

src/Maths/Silk.NET.Maths/Matrix3X2.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,47 +51,47 @@ public struct Matrix3X2<T>
5151
[IgnoreDataMember]
5252
public Vector3D<T> Column2 => new(Row1.Y, Row2.Y, Row3.Y);
5353

54-
/// <summary>The first element of the first row</summary>
54+
/// <summary>Value at row 1, column 1 of the matrix.</summary>
5555
[DataMember]
5656
public T M11
5757
{
5858
readonly get => Row1.X;
5959
set => Row1.X = value;
6060
}
6161

62-
/// <summary>The second element of the first row</summary>
62+
/// <summary>Value at row 1, column 2 of the matrix.</summary>
6363
[DataMember]
6464
public T M12
6565
{
6666
readonly get => Row1.Y;
6767
set => Row1.Y = value;
6868
}
6969

70-
/// <summary>The first element of the second row</summary>
70+
/// <summary>Value at row 2, column 1 of the matrix.</summary>
7171
[DataMember]
7272
public T M21
7373
{
7474
readonly get => Row2.X;
7575
set => Row2.X = value;
7676
}
7777

78-
/// <summary>The second element of the second row</summary>
78+
/// <summary>Value at row 2, column 2 of the matrix.</summary>
7979
[DataMember]
8080
public T M22
8181
{
8282
readonly get => Row2.Y;
8383
set => Row2.Y = value;
8484
}
8585

86-
/// <summary>The first element of the third row</summary>
86+
/// <summary>Value at row 3, column 1 of the matrix.</summary>
8787
[DataMember]
8888
public T M31
8989
{
9090
readonly get => Row3.X;
9191
set => Row3.X = value;
9292
}
9393

94-
/// <summary>The second element of the third row</summary>
94+
/// <summary>Value at row 3, column 2 of the matrix.</summary>
9595
[DataMember]
9696
public T M32
9797
{
@@ -154,8 +154,8 @@ public Matrix3X2(Vector2D<T> row1, Vector2D<T> row2, Vector2D<T> row3)
154154
Row3 = row3;
155155
}
156156

157-
/// <summary>Constructs a <see cref="Matrix3X2{T}"/> from the given Matrix4x3.</summary>
158-
/// <param name="value">The source Matrix4x3.</param>
157+
/// <summary>Constructs a <see cref="Matrix3X2{T}"/> from the given <see cref="Matrix4X3{T}"/>.</summary>
158+
/// <param name="value">The source <see cref="Matrix4X3{T}"/>.</param>
159159
public Matrix3X2(Matrix4X3<T> value)
160160
{
161161
Row1 = new(value.M11, value.M12);

src/Maths/Silk.NET.Maths/Matrix3X3.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ public struct Matrix3X3<T> : IEquatable<Matrix3X3<T>>
4545
[IgnoreDataMember]
4646
public Vector3D<T> Column1 => new(Row1.X, Row2.X, Row3.X);
4747

48-
4948
/// <summary>
5049
/// Column 2 of the matrix.
5150
/// </summary>
5251
[IgnoreDataMember]
5352
public Vector3D<T> Column2 => new(Row1.Y, Row2.Y, Row3.Y);
5453

55-
5654
/// <summary>
5755
/// Column 3 of the matrix.
5856
/// </summary>

src/Maths/Silk.NET.Maths/Matrix3X4.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,7 @@ static void VerifyBounds(int i)
194194
}
195195
}
196196

197-
/// <summary>
198-
/// Constructs a <see cref="Matrix3X4{T}"/> from the given rows.
199-
/// </summary>
200-
/// <param name="row1"></param>
201-
/// <param name="row2"></param>
202-
/// <param name="row3"></param>
197+
/// <summary>Constructs a <see cref="Matrix3X4{T}"/> from the given rows.</summary>
203198
public Matrix3X4(Vector4D<T> row1, Vector4D<T> row2, Vector4D<T> row3)
204199
{
205200
Row1 = row1;

src/Maths/Silk.NET.Maths/Matrix4X2.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,23 @@ public struct Matrix4X2<T> : IEquatable<Matrix4X2<T>>
3030
public Vector2D<T> Row1;
3131

3232
/// <summary>
33-
/// Row 2 of the matrix
33+
/// Row 2 of the matrix.
3434
/// </summary>
3535
[IgnoreDataMember]
3636
public Vector2D<T> Row2;
3737

3838
/// <summary>
39-
/// Row 3 of the matrix
39+
/// Row 3 of the matrix.
4040
/// </summary>
4141
[IgnoreDataMember]
4242
public Vector2D<T> Row3;
4343

4444
/// <summary>
45-
/// Row 4 of the matrix
45+
/// Row 4 of the matrix.
4646
/// </summary>
4747
[IgnoreDataMember]
4848
public Vector2D<T> Row4;
4949

50-
51-
5250
/// <summary>
5351
/// Column 1 of the matrix.
5452
/// </summary>
@@ -59,7 +57,7 @@ public struct Matrix4X2<T> : IEquatable<Matrix4X2<T>>
5957
/// Column 2 of the matrix.
6058
/// </summary>
6159
[IgnoreDataMember]
62-
public Vector4D<T> Column2 => new(Row1.Y, Row2.Y, Row3.X, Row4.X);
60+
public Vector4D<T> Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y);
6361

6462
/// <summary>Value at row 1, column 1 of the matrix.</summary>
6563
[DataMember]

0 commit comments

Comments
 (0)