Exemple #1
0
        public void ShouldCalculateParallelVectorToIntersectionNormal2()
        {
            // Arrage
            var movementVector       = new Vector2(-3, 3);
            var intersectionDistance = Math.Sqrt(2);
            var intersectionNormal   = new Vector2(-1, 0);

            // Act
            var parallelVector = Physic.GetLeftParallelVectorToIntersectionNormal(movementVector, intersectionDistance, intersectionNormal);

            // Assert
            var expectedVector = Vector2.Normalize(new Vector2(0, 1)) * (((movementVector.Length() - intersectionDistance) * Math.Sqrt(2)) / 2);

            Assert.AreEqual(parallelVector.X, expectedVector.X, 0.0001);
            Assert.AreEqual(parallelVector.Y, expectedVector.Y, 0.0001);
        }