From e084c9e403435eec4edf5ddd8bca15249d101a6e Mon Sep 17 00:00:00 2001 From: Voon Foo Date: Mon, 12 Apr 2021 17:27:43 +0800 Subject: [PATCH] Bug in MatrixEnumerator Matrix index should be less than (column * row) instead of (column + row) --- SharpMath/Geometry/MatrixEnumerator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SharpMath/Geometry/MatrixEnumerator.cs b/SharpMath/Geometry/MatrixEnumerator.cs index 0bceeea..f96fa5c 100644 --- a/SharpMath/Geometry/MatrixEnumerator.cs +++ b/SharpMath/Geometry/MatrixEnumerator.cs @@ -26,7 +26,7 @@ public void Dispose() public bool MoveNext() { _index++; - return _index < _matrix.ColumnCount + _matrix.RowCount; + return _index < _matrix.ColumnCount * _matrix.RowCount; } public void Reset() @@ -36,4 +36,4 @@ public void Reset() public double Current => _matrix[(uint) _index % _matrix.ColumnCount, (uint) _index / _matrix.RowCount]; } -} \ No newline at end of file +}