Skip to content

Commit

Permalink
Lowering max number of particles, see #53
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Nov 27, 2024
1 parent a5b3a28 commit f254ca1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions js/spin/model/ParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand All @@ -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() );

Expand Down
2 changes: 1 addition & 1 deletion js/spin/model/ParticleWithSpin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit f254ca1

Please sign in to comment.