示例#1
0
        public void ShouldCorrectlyCalculateParallelVectorToNormal4()
        {
            // Arrage
            var vector       = new Vector2(0, 3);
            var normalvector = new Vector2(-1, -1);

            // Act
            var parallelVector = Physic.GetParallelVectorToNormal(vector, normalvector);

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

            Assert.AreEqual(parallelVector.X, expectedVector.X, 0.0001);
            Assert.AreEqual(parallelVector.Y, expectedVector.Y, 0.0001);
        }
示例#2
0
        public void ShouldCorrectlyCalculateParallelVectorToNormal3()
        {
            // Arrage
            var vector       = new Vector2(-1, -1);
            var normalvector = new Vector2(1, 0);

            // Act
            var parallelVector = Physic.GetParallelVectorToNormal(vector, normalvector);

            // Assert
            var expectedVector = new Vector2(0, -1);

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