Skip to content

Commit e608630

Browse files
author
Dominic Beger
committed
Small code cleanup
1 parent da61232 commit e608630

File tree

9 files changed

+169
-166
lines changed

9 files changed

+169
-166
lines changed

SharpMath/Expressions/Token.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public static IEnumerable<Token> CalculateInfixTokens(string term)
199199
}
200200
else
201201
term.Remove(term.IndexOf(current), 1);
202-
// Remove the '+' as it is redundant and disturbs our calculations
202+
// Remove the '+' as it is redundant and disturbs our calculations
203203
}
204204
infixTokens.Add(ReadStringToken(term, ref i));
205205
}

SharpMath/FloatingNumberExtensions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
namespace SharpMath
1+
// Author: Dominic Beger (Trade/ProgTrade) 2016
2+
3+
namespace SharpMath
24
{
35
/// <summary>
46
/// Provides extensions for comparing floating numbers using approximations.
57
/// </summary>
68
public static class FloatingNumberExtensions
79
{
810
/// <summary>
9-
/// Determines whether two floating numbers are approximately equal to each other using the <see cref="FloatingNumber.Epsilon" /> value.
11+
/// Determines whether two floating numbers are approximately equal to each other using the
12+
/// <see cref="FloatingNumber.Epsilon" /> value.
1013
/// </summary>
1114
/// <param name="number">The current <see cref="float" />.</param>
1215
/// <param name="other">The other <see cref="float" />.</param>

SharpMath/Geometry/Matrix.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ public Matrix Negate
138138
/// </summary>
139139
public Matrix Zero => new Matrix(RowCount, ColumnCount);
140140

141+
public bool Equals(Matrix other)
142+
{
143+
if (ReferenceEquals(null, other))
144+
return false;
145+
146+
return this == other;
147+
}
148+
141149
/// <summary>
142150
/// Clones this instance.
143151
/// </summary>
@@ -440,10 +448,10 @@ public static Matrix Divide(Matrix matrix, double scalar)
440448
/// <summary>
441449
/// Implements the operator +.
442450
/// </summary>
443-
/// <param name="firstMatrix">The first <see cref="Matrix"/>.</param>
444-
/// <param name="secondMatrix">The second <see cref="Matrix"/>.</param>
451+
/// <param name="firstMatrix">The first <see cref="Matrix" />.</param>
452+
/// <param name="secondMatrix">The second <see cref="Matrix" />.</param>
445453
/// <returns>
446-
/// The result of the operator.
454+
/// The result of the operator.
447455
/// </returns>
448456
public static Matrix operator +(Matrix firstMatrix, Matrix secondMatrix)
449457
{
@@ -453,36 +461,36 @@ public static Matrix Divide(Matrix matrix, double scalar)
453461
/// <summary>
454462
/// Implements the operator -.
455463
/// </summary>
456-
/// <param name="firstMatrix">The first <see cref="Matrix"/>.</param>
457-
/// <param name="secondMatrix">The second <see cref="Matrix"/>.</param>
464+
/// <param name="firstMatrix">The first <see cref="Matrix" />.</param>
465+
/// <param name="secondMatrix">The second <see cref="Matrix" />.</param>
458466
/// <returns>
459-
/// The result of the operator.
467+
/// The result of the operator.
460468
/// </returns>
461469
public static Matrix operator -(Matrix firstMatrix, Matrix secondMatrix)
462470
{
463471
return Subtract(firstMatrix, secondMatrix);
464472
}
465473

466474
/// <summary>
467-
/// Implements the operator * to multiply a <see cref="Matrix"/> with the specified scalar.
475+
/// Implements the operator * to multiply a <see cref="Matrix" /> with the specified scalar.
468476
/// </summary>
469477
/// <param name="scalar">The scalar.</param>
470-
/// <param name="matrix">The <see cref="Matrix"/>.</param>
478+
/// <param name="matrix">The <see cref="Matrix" />.</param>
471479
/// <returns>
472-
/// The result of the operator.
480+
/// The result of the operator.
473481
/// </returns>
474482
public static Matrix operator *(double scalar, Matrix matrix)
475483
{
476484
return Multiply(matrix, scalar);
477485
}
478486

479487
/// <summary>
480-
/// Implements the operator * to multiply a <see cref="Matrix"/> with the specified scalar.
488+
/// Implements the operator * to multiply a <see cref="Matrix" /> with the specified scalar.
481489
/// </summary>
482-
/// <param name="matrix">The <see cref="Matrix"/>.</param>
490+
/// <param name="matrix">The <see cref="Matrix" />.</param>
483491
/// <param name="scalar">The scalar.</param>
484492
/// <returns>
485-
/// The result of the operator.
493+
/// The result of the operator.
486494
/// </returns>
487495
public static Matrix operator *(Matrix matrix, double scalar)
488496
{
@@ -492,10 +500,10 @@ public static Matrix Divide(Matrix matrix, double scalar)
492500
/// <summary>
493501
/// Implements the operator *.
494502
/// </summary>
495-
/// <param name="firstMatrix">The first <see cref="Matrix"/>.</param>
496-
/// <param name="secondMatrix">The second <see cref="Matrix"/>.</param>
503+
/// <param name="firstMatrix">The first <see cref="Matrix" />.</param>
504+
/// <param name="secondMatrix">The second <see cref="Matrix" />.</param>
497505
/// <returns>
498-
/// The result of the operator.
506+
/// The result of the operator.
499507
/// </returns>
500508
public static Matrix operator *(Matrix firstMatrix, Matrix secondMatrix)
501509
{
@@ -542,14 +550,6 @@ public override int GetHashCode()
542550
}
543551
}
544552

545-
public bool Equals(Matrix other)
546-
{
547-
if (ReferenceEquals(null, other))
548-
return false;
549-
550-
return this == other;
551-
}
552-
553553
/// <summary>
554554
/// Creates a new object that is a copy of the current instance.
555555
/// </summary>

SharpMath/Geometry/Matrix3x3.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ public static Matrix3x3 Translation(double x, double y)
111111
/// <summary>
112112
/// Implements the operator +.
113113
/// </summary>
114-
/// <param name="firstMatrix">The first <see cref="Matrix3x3"/>.</param>
115-
/// <param name="secondMatrix">The second <see cref="Matrix3x3"/>.</param>
114+
/// <param name="firstMatrix">The first <see cref="Matrix3x3" />.</param>
115+
/// <param name="secondMatrix">The second <see cref="Matrix3x3" />.</param>
116116
/// <returns>
117-
/// The result of the operator.
117+
/// The result of the operator.
118118
/// </returns>
119119
public static Matrix3x3 operator +(Matrix3x3 firstMatrix, Matrix3x3 secondMatrix)
120120
{
@@ -124,49 +124,49 @@ public static Matrix3x3 Translation(double x, double y)
124124
/// <summary>
125125
/// Implements the operator -.
126126
/// </summary>
127-
/// <param name="firstMatrix">The first <see cref="Matrix3x3"/>.</param>
128-
/// <param name="secondMatrix">The second <see cref="Matrix3x3"/>.</param>
127+
/// <param name="firstMatrix">The first <see cref="Matrix3x3" />.</param>
128+
/// <param name="secondMatrix">The second <see cref="Matrix3x3" />.</param>
129129
/// <returns>
130-
/// The result of the operator.
130+
/// The result of the operator.
131131
/// </returns>
132132
public static Matrix3x3 operator -(Matrix3x3 firstMatrix, Matrix3x3 secondMatrix)
133133
{
134134
return FromMatrix(Subtract(firstMatrix, secondMatrix));
135135
}
136136

137137
/// <summary>
138-
/// Implements the operator * to multiply a <see cref="Matrix3x3"/> with the specified scalar.
138+
/// Implements the operator * to multiply a <see cref="Matrix3x3" /> with the specified scalar.
139139
/// </summary>
140140
/// <param name="scalar">The scalar.</param>
141-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
141+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
142142
/// <returns>
143-
/// The result of the operator.
143+
/// The result of the operator.
144144
/// </returns>
145145
public static Matrix3x3 operator *(double scalar, Matrix3x3 matrix)
146146
{
147147
return FromMatrix(Multiply(matrix, scalar));
148148
}
149149

150150
/// <summary>
151-
/// Implements the operator * to multiply a <see cref="Matrix3x3"/> with the specified scalar.
151+
/// Implements the operator * to multiply a <see cref="Matrix3x3" /> with the specified scalar.
152152
/// </summary>
153-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
153+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
154154
/// <param name="scalar">The scalar.</param>
155155
/// <returns>
156-
/// The result of the operator.
156+
/// The result of the operator.
157157
/// </returns>
158158
public static Matrix3x3 operator *(Matrix3x3 matrix, double scalar)
159159
{
160160
return FromMatrix(Multiply(matrix, scalar));
161161
}
162162

163163
/// <summary>
164-
/// Implements the operator * to transform a <see cref="Vector2"/> with a <see cref="Matrix3x3"/>.
164+
/// Implements the operator * to transform a <see cref="Vector2" /> with a <see cref="Matrix3x3" />.
165165
/// </summary>
166-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
167-
/// <param name="vector">The <see cref="Vector2"/>.</param>
166+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
167+
/// <param name="vector">The <see cref="Vector2" />.</param>
168168
/// <returns>
169-
/// The result of the operator.
169+
/// The result of the operator.
170170
/// </returns>
171171
public static Vector2 operator *(Matrix3x3 matrix, Vector2 vector)
172172
{
@@ -175,12 +175,12 @@ public static Matrix3x3 Translation(double x, double y)
175175
}
176176

177177
/// <summary>
178-
/// Implements the operator * to transform a <see cref="Vector2"/> with a <see cref="Matrix3x3"/>.
178+
/// Implements the operator * to transform a <see cref="Vector2" /> with a <see cref="Matrix3x3" />.
179179
/// </summary>
180-
/// <param name="vector">The <see cref="Vector2"/>.</param>
181-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
180+
/// <param name="vector">The <see cref="Vector2" />.</param>
181+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
182182
/// <returns>
183-
/// The result of the operator.
183+
/// The result of the operator.
184184
/// </returns>
185185
public static Vector2 operator *(Vector2 vector, Matrix3x3 matrix)
186186
{
@@ -189,12 +189,12 @@ public static Matrix3x3 Translation(double x, double y)
189189
}
190190

191191
/// <summary>
192-
/// Implements the operator * to transform a <see cref="Vector3"/> with a <see cref="Matrix3x3"/>.
192+
/// Implements the operator * to transform a <see cref="Vector3" /> with a <see cref="Matrix3x3" />.
193193
/// </summary>
194-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
195-
/// <param name="vector">The <see cref="Vector3"/>.</param>
194+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
195+
/// <param name="vector">The <see cref="Vector3" />.</param>
196196
/// <returns>
197-
/// The result of the operator.
197+
/// The result of the operator.
198198
/// </returns>
199199
public static Vector3 operator *(Matrix3x3 matrix, Vector3 vector)
200200
{
@@ -203,12 +203,12 @@ public static Matrix3x3 Translation(double x, double y)
203203
}
204204

205205
/// <summary>
206-
/// Implements the operator * to transform a <see cref="Vector3"/> with a <see cref="Matrix3x3"/>.
206+
/// Implements the operator * to transform a <see cref="Vector3" /> with a <see cref="Matrix3x3" />.
207207
/// </summary>
208-
/// <param name="vector">The <see cref="Vector3"/>.</param>
209-
/// <param name="matrix">The <see cref="Matrix3x3"/>.</param>
208+
/// <param name="vector">The <see cref="Vector3" />.</param>
209+
/// <param name="matrix">The <see cref="Matrix3x3" />.</param>
210210
/// <returns>
211-
/// The result of the operator.
211+
/// The result of the operator.
212212
/// </returns>
213213
public static Vector3 operator *(Vector3 vector, Matrix3x3 matrix)
214214
{
@@ -219,10 +219,10 @@ public static Matrix3x3 Translation(double x, double y)
219219
/// <summary>
220220
/// Implements the operator *.
221221
/// </summary>
222-
/// <param name="firstMatrix">The first <see cref="Matrix3x3"/>.</param>
223-
/// <param name="secondMatrix">The second <see cref="Matrix3x3"/>.</param>
222+
/// <param name="firstMatrix">The first <see cref="Matrix3x3" />.</param>
223+
/// <param name="secondMatrix">The second <see cref="Matrix3x3" />.</param>
224224
/// <returns>
225-
/// The result of the operator.
225+
/// The result of the operator.
226226
/// </returns>
227227
public static Matrix3x3 operator *(Matrix3x3 firstMatrix, Matrix3x3 secondMatrix)
228228
{

0 commit comments

Comments
 (0)