예제 #1
0
		public void ParticleIntegrationDoesNothingWhenNoForces()
		{
			// Arrange.
			var particle = new Particle();
			particle.Mass = 2f;

			// Act.
			particle.Integrate(1.0f);

			// Assert.
			Assert.That(particle.Position, Is.EqualTo(Point3D.Zero));
			Assert.That(particle.Velocity, Is.EqualTo(Vector3D.Zero));
			Assert.That(particle.Acceleration, Is.EqualTo(Vector3D.Zero));
		}
예제 #2
0
		public void ParticleIntegrationAltersValuesCorrectly()
		{
			// Arrange.
			var particle = new Particle();
			particle.Mass = 2f;
			particle.Damping = 0.99f;
			particle.AddForce(Vector3D.Forward);

			// Act.
			particle.Integrate(1.0f);

			// Assert.
			Assert.That(particle.Position, Is.EqualTo(Point3D.Zero));
			Assert.That(particle.Velocity, Is.EqualTo(new Vector3D(0, 0, -0.495f)));
			Assert.That(particle.Acceleration, Is.EqualTo(Vector3D.Zero));
		}