@@ -21,7 +21,7 @@ public class ParticleSystem {
21
21
public static double width = 64 ;
22
22
public static int numOfParticles = 8192 ;
23
23
public static double emitRate = 6.0 ;
24
- public static double injectRate = 0 .0 ;
24
+ public static double injectRate = 1 .0 ;
25
25
public static double escapeProb = 0.9 ;
26
26
public static double collisionThreshhold = 0.1 ;
27
27
@@ -550,29 +550,30 @@ public void emmitIota(double dt) {
550
550
}
551
551
552
552
public void injectIota (double dt ) {
553
- double count = injectRate * dt ;
554
- for (int i = 0 ; i < count ; i ++) {
555
- int j = availableIndex ();
556
- SKI .Combinator iota = SKI .iota ();
557
-
558
- double px = Generators .uniform_01 .generate () * width ;
559
- double py = Generators .uniform_01 .generate () * width ;
560
- double pz = Generators .uniform_01 .generate () * width ;
561
- double vx = Generators .uniform_n1p1 .generate ();
562
- double vy = Generators .uniform_n1p1 .generate ();
563
- double vz = Generators .uniform_n1p1 .generate ();
564
- double sq = vx * vx + vy * vy + vz * vz ;
565
- double s = Math .sqrt (sq );
566
- vx = vx / s ;
567
- vy = vy / s ;
568
- vz = vz / s ;
569
-
570
- update (j , iota , iota .mass (), px , py , pz , vx , vy , vz , 0 );
553
+ if (t > 5000.0 ) {
554
+ double count = injectRate * dt ;
555
+ for (int i = 0 ; i < count ; i ++) {
556
+ int j = availableIndex ();
557
+ SKI .Combinator iota = SKI .iota ();
558
+
559
+ double px = Generators .uniform_01 .generate () * width ;
560
+ double py = Generators .uniform_01 .generate () * width ;
561
+ double pz = Generators .uniform_01 .generate () * width ;
562
+ double vx = Generators .uniform_n1p1 .generate ();
563
+ double vy = Generators .uniform_n1p1 .generate ();
564
+ double vz = Generators .uniform_n1p1 .generate ();
565
+ double sq = vx * vx + vy * vy + vz * vz ;
566
+ double s = Math .sqrt (sq );
567
+ vx = vx / s ;
568
+ vy = vy / s ;
569
+ vz = vz / s ;
570
+
571
+ update (j , iota , iota .mass (), px , py , pz , vx , vy , vz , 0 );
572
+ }
571
573
}
572
574
}
573
575
574
576
public void escapeIota (double dt ) {
575
- if (t > 5000.0 ) {
576
577
for (int i = 0 ; i < numOfParticles ; i ++) {
577
578
if (flag .element (i ) > 0 && combinators .get (i ) != null ) {
578
579
String script = combinators .get (i ).script ();
@@ -583,7 +584,6 @@ public void escapeIota(double dt) {
583
584
}
584
585
}
585
586
}
586
- }
587
587
}
588
588
589
589
public void splitExec (double dt ) {
0 commit comments