From f254ca17c4fe1f609d1d5b083fbaa116c0574fd0 Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Wed, 27 Nov 2024 14:59:14 -0500 Subject: [PATCH] Lowering max number of particles, see https://github.com/phetsims/quantum-measurement/issues/53 --- js/spin/model/ParticleSystem.ts | 4 +--- js/spin/model/ParticleWithSpin.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/js/spin/model/ParticleSystem.ts b/js/spin/model/ParticleSystem.ts index ae3490c..18b1ce3 100644 --- a/js/spin/model/ParticleSystem.ts +++ b/js/spin/model/ParticleSystem.ts @@ -18,7 +18,7 @@ import SpinModel from './SpinModel.js'; import SternGerlach from './SternGerlach.js'; const MAX_NUMBER_OF_SINGLE_PARTICLES = 50; -const MAX_NUMBER_OF_MULTIPLE_PARTICLES = 5000; +const MAX_NUMBER_OF_MULTIPLE_PARTICLES = 1250; const PARTICLE_RAY_WIDTH = 0.02; const MAX_PARTICLE_CREATION_RATE = 5; // max rate of particles created per second @@ -56,7 +56,6 @@ export class ParticleSystem { const particleTandem = multipleParticlesTandem.createTandem( 'particle' + index ); return new ParticleWithSpin( new Vector2( PARTICLE_RAY_WIDTH * ( dotRandom.nextDouble() * 2 - 1 ), PARTICLE_RAY_WIDTH * ( dotRandom.nextDouble() * 2 - 1 ) ), particleTandem ); } ); - } public shootSingleParticle(): void { @@ -71,7 +70,6 @@ export class ParticleSystem { particle.reset(); particle.activeProperty.value = true; - // Set the first spin vector to the state of the generated particles particle.spinVectors[ 0 ].set( this.model.derivedSpinStateProperty.value.copy() ); diff --git a/js/spin/model/ParticleWithSpin.ts b/js/spin/model/ParticleWithSpin.ts index e00ab2a..5f92280 100644 --- a/js/spin/model/ParticleWithSpin.ts +++ b/js/spin/model/ParticleWithSpin.ts @@ -64,7 +64,7 @@ export class ParticleWithSpin { this.positionProperty.value = this.positionProperty.value.plus( this.velocityProperty.value.times( dt ) ); - if ( this.lifetime > 5 ) { + if ( this.lifetime > 4 ) { this.reset(); } }