Skip to content

Commit a25b22e

Browse files
committed
delay injection after 5000
1 parent 151bcfe commit a25b22e

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/main/java/skiverse/ParticleSystem.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ParticleSystem {
2121
public static double width = 64;
2222
public static int numOfParticles = 8192;
2323
public static double emitRate = 6.0;
24-
public static double injectRate = 0.0;
24+
public static double injectRate = 1.0;
2525
public static double escapeProb = 0.9;
2626
public static double collisionThreshhold = 0.1;
2727

@@ -550,29 +550,30 @@ public void emmitIota(double dt) {
550550
}
551551

552552
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+
}
571573
}
572574
}
573575

574576
public void escapeIota(double dt) {
575-
if (t > 5000.0) {
576577
for (int i = 0; i < numOfParticles; i++) {
577578
if (flag.element(i) > 0 && combinators.get(i) != null) {
578579
String script = combinators.get(i).script();
@@ -583,7 +584,6 @@ public void escapeIota(double dt) {
583584
}
584585
}
585586
}
586-
}
587587
}
588588

589589
public void splitExec(double dt) {

0 commit comments

Comments
 (0)