コード例 #1
0
        public void TestCalculateSeparatingVelocityWithOneObject()
        {
            var p = new Particle
            {
                Position = new Vector2D(0, 0),
                Velocity = new Vector2D(1, 0),
                Mass     = 1
            };
            var contact = new ParticleContact(p, null, 0.5, 1, new Vector2D(-1, 0));

            Assert.AreEqual(-1, contact.CalculateSeparatingVelocity());
        }
コード例 #2
0
        public void TestCalculateSeparatingVelocityWithTwoObject()
        {
            var p = new List <Particle>
            {
                new Particle
                {
                    Position = new Vector2D(0, 0),
                    Velocity = new Vector2D(1, 0),
                    Mass     = 1
                },
                new Particle
                {
                    Position = new Vector2D(2, 0),
                    Velocity = new Vector2D(0, 0),
                    Mass     = 1
                }
            };
            var contact = new ParticleContact(p[0], p[1], 0.5, 1, new Vector2D(-1, 0));

            Assert.AreEqual(-1, contact.CalculateSeparatingVelocity());
        }