Exemple #1
0
 public void SeparationVector_Rectangle_Up_Correct()
 {
     MCircle c = new MCircle(new MVector2(0, 0), 2f);
     MRectangle r = new MRectangle(-32, 1, 64, 1);
     MVector2 sepVector = c.SeparationVector(r);
     MVector2 expected = new MVector2(0, -1);
     Assert.AreEqual(expected, sepVector);
 }
Exemple #2
0
 public void SeparationVector_Rectangle_Right_Correct()
 {
     MCircle c = new MCircle(new MVector2(3, 0), 2f);
     MRectangle r = new MRectangle(1, -32, 1, 64);
     MVector2 sepVector = c.SeparationVector(r);
     MVector2 expected = new MVector2(1, 0);
     Assert.AreEqual(expected, sepVector);
 }
Exemple #3
0
 public void SeparationVector_Rectangle_TopRight_CorrectDirection()
 {
     MCircle c = new MCircle(new MVector2(2, -2), 2f);
     MRectangle r = new MRectangle(-1, -1, 2, 2);
     MVector2 sepVector = c.SeparationVector(r);
     Assert.IsTrue(sepVector.X > 0);
     Assert.IsTrue(sepVector.Y < 0);
 }
Exemple #4
0
 public void SeparationVector_Rectangle_Outside_Corner_ZeroVector()
 {
     MCircle c = new MCircle(new MVector2(-128, 128), 32f);
     MRectangle r = new MRectangle(-64, -64, 128, 128);
     MVector2 sepVector = c.SeparationVector(r);
     Assert.AreEqual(MVector2.Zero, sepVector);
 }
Exemple #5
0
 public void SeparationVector_Rectangle_Outside_ZeroVector()
 {
     MCircle c = new MCircle(new MVector2(100, -100), 2f);
     MRectangle r = new MRectangle(1, -32, 1, 64);
     MVector2 sepVector = c.SeparationVector(r);
     Assert.AreEqual(MVector2.Zero, sepVector);
 }
Exemple #6
0
 public void SeparationVector_Rectangle_BottomLeft_CorrectDirection()
 {
     MCircle c = new MCircle(new MVector2(-2, 2), 2f);
     MRectangle r = new MRectangle(-1, -1, 2, 2);
     MVector2 sepVector = c.SeparationVector(r);
     Assert.IsTrue(sepVector.X < 0);
     Assert.IsTrue(sepVector.Y > 0);
 }
Exemple #7
0
 public void SeparationVector_MVector2_Outside_ZeroVector()
 {
     MCircle c1 = new MCircle(new MVector2(0, 300), 2f);
     MVector2 v = new MVector2(0, 4);
     MVector2 separated = c1.SeparationVector(v);
     Assert.AreEqual(MVector2.Zero, separated);
 }
Exemple #8
0
 public void SeparationVector_MVector2_Correct()
 {
     MCircle c1 = new MCircle(new MVector2(0, 3), 2f);
     MVector2 v = new MVector2(0, 4);
     MVector2 separated = c1.SeparationVector(v);
     MVector2 expected = new MVector2(0, -1);
     Assert.AreEqual(expected, separated);
 }
Exemple #9
0
 public void SeparationVector_Circle_Outside_ZeroVector()
 {
     MCircle c1 = new MCircle(new MVector2(0, 3), 2f);
     MCircle c2 = new MCircle(new MVector2(-300, 2), 1f);
     MVector2 v = c1.SeparationVector(c2);
     Assert.AreEqual(MVector2.Zero, v);
 }
Exemple #10
0
 public void SeparationVector_Circle_Correct()
 {
     MCircle c1 = new MCircle(new MVector2(0, 3), 2f);
     MCircle c2 = new MCircle(new MVector2(0, 2), 1f);
     MVector2 v = c1.SeparationVector(c2);
     MVector2 expected = new MVector2(0, 2);
     Assert.AreEqual(expected, v);
 }