@@ -46,26 +46,26 @@ public void CanCalculateLength()
4646 [ TestMethod ]
4747 public void CanCalculateScalarProduct ( )
4848 {
49- Assert . AreEqual ( 0 , Vector2 . UnitX . ScalarProduct ( Vector2 . UnitY ) ) ;
50- Assert . AreEqual ( 20 , Vector . ScalarProduct ( new Vector2 ( 2 , 4 ) , new Vector2 ( 4 , 3 ) ) ) ;
51- Assert . AreEqual ( 0 , Vector . ScalarProduct ( Vector3 . Forward , Vector3 . Up ) ) ;
52- Assert . AreEqual ( 8 , Vector . ScalarProduct ( new Vector3 ( 2 , 3 , 1 ) , new Vector3 ( - 1 , 2 , 4 ) ) ) ;
49+ Assert . AreEqual ( 0 , Vector2 . UnitX . DotProduct ( Vector2 . UnitY ) ) ;
50+ Assert . AreEqual ( 20 , VectorUtils . DotProduct ( new Vector2 ( 2 , 4 ) , new Vector2 ( 4 , 3 ) ) ) ;
51+ Assert . AreEqual ( 0 , VectorUtils . DotProduct ( Vector3 . Forward , Vector3 . Up ) ) ;
52+ Assert . AreEqual ( 8 , VectorUtils . DotProduct ( new Vector3 ( 2 , 3 , 1 ) , new Vector3 ( - 1 , 2 , 4 ) ) ) ;
5353 }
5454
5555 [ TestMethod ]
5656 public void CanCalculateDistance ( )
5757 {
5858 var vector = new Vector3 ( 10 , 5 , 3 ) ;
5959 var secondVector = new Vector3 ( 5 , 6 , 1 ) ; // 5, -1, 2 // Magnitude: sqrt(30)
60- Assert . AreEqual ( Math . Sqrt ( 30 ) , vector . DistanceTo ( secondVector ) ) ;
60+ Assert . AreEqual ( Math . Sqrt ( 30 ) , vector . Distance ( secondVector ) ) ;
6161 }
6262
6363 [ TestMethod ]
6464 public void CanCalculateCrossProduct ( )
6565 {
6666 var vector = new Vector3 ( 1 , - 5 , 2 ) ;
6767 var secondVector = new Vector3 ( 2 , 0 , 3 ) ;
68- var resultVector = vector . CrossProduct ( secondVector ) ;
68+ var resultVector = vector . VectorProduct ( secondVector ) ;
6969
7070 Assert . AreEqual ( - 15 , resultVector . X ) ;
7171 Assert . AreEqual ( 1 , resultVector . Y ) ;
@@ -76,7 +76,7 @@ public void CanCalculateCrossProduct()
7676 public void CanGetCorrectLaTeXString ( )
7777 {
7878 var vector = new Vector3 ( 1 , 6 , 8 ) ;
79- Assert . AreEqual ( @"\left( \begin{array}{c} 1 \\ 6 \\ 8 \end{array} \right)" , vector . LaTeXString ) ;
79+ Assert . AreEqual ( @"\left( \begin{array}{c} 1 \\ 6 \\ 8 \end{array} \right)" , vector . ToLaTeXString ( ) ) ;
8080 }
8181
8282 [ TestMethod ]
@@ -135,7 +135,7 @@ public void CanCalculateAngle()
135135 var vector2 = Vector2 . UnitY ;
136136
137137 Assert . AreEqual ( Math . PI / 2 , vector1 . Angle ( vector2 ) ) ;
138- Assert . IsTrue ( vector1 . IsOrthogonalTo ( vector2 ) ) ;
138+ Assert . IsTrue ( vector1 . CheckForOrthogonality ( vector2 ) ) ;
139139 }
140140
141141 [ TestMethod ]
@@ -170,7 +170,7 @@ public void CompareAreaCalculations()
170170 var secondVector = new Vector3 ( 1 , - 2 , 3 ) ;
171171
172172 stopWatch . Start ( ) ;
173- double crossProductArea = Vector3 . CrossProduct ( firstVector , secondVector ) . Magnitude ;
173+ double crossProductArea = Vector3 . VectorProduct ( firstVector , secondVector ) . Magnitude ;
174174 stopWatch . Stop ( ) ;
175175 // This is faster, if the vectors are already 3-dimensional, because we have no arccos, sin etc.
176176 Debug . Print ( "Vector3 area calculation over the cross product takes " + stopWatch . ElapsedMilliseconds +
@@ -190,7 +190,7 @@ public void CompareAreaCalculations()
190190
191191 stopWatch . Restart ( ) ;
192192 double secondCrossProductArea =
193- Vector3 . CrossProduct ( thirdVector . Convert < Vector3 > ( ) , fourthVector . Convert < Vector3 > ( ) ) . Magnitude ;
193+ Vector3 . VectorProduct ( thirdVector . Convert < Vector3 > ( ) , fourthVector . Convert < Vector3 > ( ) ) . Magnitude ;
194194 stopWatch . Stop ( ) ;
195195 Debug . Print ( "Vector2 area calculation over the cross product takes " + stopWatch . ElapsedMilliseconds +
196196 " milliseconds." ) ;
@@ -207,79 +207,76 @@ public void CompareAreaCalculations()
207207 [ TestMethod ]
208208 public void CanDetermineIfVectorsAreOrthogonal ( )
209209 {
210- Assert . IsTrue ( Vector3 . Forward . IsOrthogonalTo ( Vector3 . Up ) ) ;
211- Assert . IsFalse ( Vector3 . Forward . IsOrthogonalTo ( Vector3 . Back ) ) ;
212- Assert . IsFalse ( Vector3 . Zero . IsOrthogonalTo ( Vector3 . UnitX ) ) ;
210+ Assert . IsTrue ( Vector3 . Forward . CheckForOrthogonality ( Vector3 . Up ) ) ;
211+ Assert . IsFalse ( Vector3 . Forward . CheckForOrthogonality ( Vector3 . Back ) ) ;
212+ Assert . IsFalse ( Vector3 . Zero . CheckForOrthogonality ( Vector3 . UnitX ) ) ;
213213 }
214214
215215 [ TestMethod ]
216216 public void CanDetermineIfVectorsAreOrthonormal ( )
217217 {
218- Assert . IsTrue ( Vector3 . Forward . IsOrthonormalTo ( Vector3 . Up ) ) ;
219- Assert . IsTrue ( Vector3 . Back . IsOrthonormalTo ( Vector3 . Down ) ) ;
220- Assert . IsFalse ( Vector3 . Forward . IsOrthonormalTo ( Vector3 . Back ) ) ;
221- Assert . IsFalse ( Vector3 . Forward . IsOrthonormalTo ( new Vector3 ( 2 , 3 , 2 ) ) ) ;
218+ Assert . IsTrue ( Vector3 . Forward . CheckForOrthonormality ( Vector3 . Up ) ) ;
219+ Assert . IsTrue ( Vector3 . Back . CheckForOrthonormality ( Vector3 . Down ) ) ;
220+ Assert . IsFalse ( Vector3 . Forward . CheckForOrthonormality ( Vector3 . Back ) ) ;
221+ Assert . IsFalse ( Vector3 . Forward . CheckForOrthonormality ( new Vector3 ( 2 , 3 , 2 ) ) ) ;
222222 }
223223
224224 [ TestMethod ]
225225 public void CanDetermineIfVectorsAreParallel ( )
226226 {
227- Assert . IsTrue ( new Vector3 ( 2 , 3 , 3 ) . IsParallelTo ( new Vector3 ( 4 , 6 , 6 ) ) ) ;
228- Assert . IsTrue ( new Vector3 ( 1 , 2 , 3 ) . IsParallelTo ( new Vector3 ( 3 , 6 , 9 ) ) ) ;
229- Assert . IsFalse ( new Vector3 ( 0 , 1 , 3 ) . IsParallelTo ( new Vector3 ( 0 , 3 , 2 ) ) ) ;
227+ Assert . IsTrue ( new Vector3 ( 2 , 3 , 3 ) . CheckForParallelism ( new Vector3 ( 4 , 6 , 6 ) ) ) ;
228+ Assert . IsTrue ( new Vector3 ( 1 , 2 , 3 ) . CheckForParallelism ( new Vector3 ( 3 , 6 , 9 ) ) ) ;
229+ Assert . IsFalse ( new Vector3 ( 0 , 1 , 3 ) . CheckForParallelism ( new Vector3 ( 0 , 3 , 2 ) ) ) ;
230230 }
231231
232232 [ TestMethod ]
233233 public void CanConvertVectorIntoMatrices ( )
234234 {
235- var firstMatrix = new Matrix ( 3 , 1 )
235+ var firstMatrix = new Matrix3x1 ( )
236236 {
237237 [ 0 , 0 ] = 1 ,
238238 [ 1 , 0 ] = 0 ,
239239 [ 2 , 0 ] = 0
240240 } ;
241- var firstVectorMatrix = Vector3 . Right . AsVerticalMatrix ( ) ;
241+ var firstVectorMatrix = Vector3 . Right . AsVerticalMatrix < Matrix3x1 > ( ) ;
242242 Assert . AreEqual ( firstMatrix , firstVectorMatrix ) ;
243243
244- var secondMatrix = new Matrix ( 1 , 3 )
244+ var secondMatrix = new Matrix1x3 ( )
245245 {
246246 [ 0 , 0 ] = 1 ,
247247 [ 0 , 1 ] = 0 ,
248248 [ 0 , 2 ] = 0
249249 } ;
250- var secondVectorMatrix = Vector3 . Right . AsHorizontalMatrix ( ) ;
250+ var secondVectorMatrix = Vector3 . Right . AsHorizontalMatrix < Matrix1x3 > ( ) ;
251251 Assert . AreEqual ( secondMatrix , secondVectorMatrix ) ;
252252 }
253253
254254 [ TestMethod ]
255255 public void CanCompareVectors ( )
256256 {
257257 // Let's see, if the dimension check is working
258- var vector = new Vector ( 2 ) ;
259- var secondVector = new Vector ( 3 ) ;
258+ var vector = new Vector3 ( ) ;
259+ var secondVector = new Vector2 ( ) ;
260260 Assert . IsFalse ( vector . Equals ( secondVector ) ) ;
261- Assert . IsFalse ( vector == secondVector ) ;
262- Assert . IsTrue ( vector != secondVector ) ;
263261
264262 // Let's see, if the coordinate comparison is working (in this case simply two zero vectors)
265- var thirdVector = new Vector ( 4 ) ;
266- var fourthVector = new Vector ( 4 ) ;
263+ var thirdVector = new Vector4 ( ) ;
264+ var fourthVector = new Vector4 ( ) ;
267265 Assert . IsTrue ( thirdVector . Equals ( fourthVector ) ) ;
268266 Assert . IsTrue ( thirdVector == fourthVector ) ;
269267 Assert . IsFalse ( thirdVector != fourthVector ) ;
270268
271269 // Let's see, if the coordinate comparison is working when we have the same dimension but different coordinate values
272- var fifthVector = new Vector ( 3 )
270+ var fifthVector = new Vector3 ( )
273271 {
274272 [ 0 ] = 1 ,
275273 [ 1 ] = 2 ,
276274 [ 2 ] = 1
277275 } ;
278-
279- Assert . AreEqual ( fifthVector , new Vector3 ( 1 , 2 , 1 ) ) ;
276+
280277 Assert . AreEqual ( new Vector3 ( 1 , 2 , 1 ) , fifthVector ) ;
281278
282- var sixthVector = new Vector ( 3 )
279+ var sixthVector = new Vector3 ( )
283280 {
284281 [ 0 ] = 2 ,
285282 [ 1 ] = 2 ,
0 commit comments