本文整理汇总了C#中Particle.Integrate方法的典型用法代码示例。如果您正苦于以下问题:C# Particle.Integrate方法的具体用法?C# Particle.Integrate怎么用?C# Particle.Integrate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Particle
的用法示例。
在下文中一共展示了Particle.Integrate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Integrate_TryingToIntegrateWithDurationOfZeroCausesAnExceptionToBeThrown
public void Integrate_TryingToIntegrateWithDurationOfZeroCausesAnExceptionToBeThrown()
{
try
{
var particle = new Particle();
particle.Integrate(0.0);
Assert.Fail("Exception was not thrown");
}
catch (InvalidDurationException ex)
{
Assert.AreEqual("Duration can not be zero", ex.Message);
}
}
示例2: Integrate_AddingDampingToAParticleCausesItsVelocityToBeReducedComparedWithNoDamping
public void Integrate_AddingDampingToAParticleCausesItsVelocityToBeReducedComparedWithNoDamping()
{
var particleNoDamping = new Particle(Vector3.ZeroVector, Vector3.ZeroVector);
var particleWithDamping = new Particle(Vector3.ZeroVector, Vector3.ZeroVector, 0.0, 0.9);
particleNoDamping.Integrate(1.0);
particleWithDamping.Integrate(1.0);
Assert.AreEqual(-10, particleNoDamping.Velocity.Y);
Assert.AreEqual(-9, particleWithDamping.Velocity.Y);
}
示例3: Particle
public void Integrate_CanAddForcesTogether_AndWithCombinedForcesAddedToGravity_WhenIntegrating_ParticlesVelocityIsUpdated()
{
var particleNoForces = new Particle(Vector3.ZeroVector, Vector3.ZeroVector, 0.5);
var particleWithForces = new Particle(Vector3.ZeroVector, Vector3.ZeroVector, 0.5);
for (var i = 0; i < 5; i++)
{
particleWithForces.AddForce(new Vector3(0.5, 1.0, 1.5));
}
particleNoForces.Integrate(1.0);
particleWithForces.Integrate(1.0);
Assert.IsTrue(particleNoForces.Velocity.Equals(new Vector3(0.0, -10.0, 0.0)));
Assert.IsTrue(particleWithForces.Velocity.Equals(new Vector3(1.25, -7.5, 3.75)));
}
示例4: Integrate_IfTheMassOfTheParticleIsInfinite_ForcesOtherThanGravityHaveNoEffect
public void Integrate_IfTheMassOfTheParticleIsInfinite_ForcesOtherThanGravityHaveNoEffect()
{
var particleNoForces = new Particle();
var particleForces = new Particle();
particleForces.AddForce(new Vector3(3.0, 4.0, 5.0));
particleNoForces.Integrate(1.0);
particleForces.Integrate(1.0);
Assert.IsTrue(particleForces.Position.Equals(particleNoForces.Position));
}
示例5: Integrate_WithJustGravityAndNoOtherForces_IntegratingToUpdateTheParticle_UpdatesTheParticlesVelocity
public void Integrate_WithJustGravityAndNoOtherForces_IntegratingToUpdateTheParticle_UpdatesTheParticlesVelocity()
{
var particle = new Particle(TestPosition);
particle.Integrate(0.5);
Assert.IsTrue(particle.Velocity.Equals(new Vector3(0.0, -5.0, 0.0)));
}
示例6: Integrate_WithJustGravityAndNoOtherForces_IntegratingToUpdateTheParticle_UpdatesTheParticlesPosition
public void Integrate_WithJustGravityAndNoOtherForces_IntegratingToUpdateTheParticle_UpdatesTheParticlesPosition()
{
var particle = new Particle(TestPosition, TestVelocity);
particle.Integrate(0.5);
Assert.IsTrue(particle.Position.Equals(new Vector3(7.85, 8.2, 8.85)));
}