// redraw all particles private void redraw(double limit) { StdDraw.clear(); for (int i = 0; i < particles.length; i++) { particles[i].draw(); } StdDraw.show(); StdDraw.pause(20); if (t < limit) { pq.insert(new Event(t + 1.0 / HZ, null, null)); } }
private void redraw(double num) { StdDraw.clear(); for (int i = 0; i < this.particles.Length; i++) { this.particles[i].draw(); } StdDraw.show(20); if (this.t < num) { this.pq.insert(new CollisionSystem.Event(this.t + (double)1f / this.hz, null, null)); } }
/**/ public static void main(string[] strarr) { StdDraw.setXscale(0.045454545454545456, 0.95454545454545459); StdDraw.setYscale(0.045454545454545456, 0.95454545454545459); StdDraw.show(0); Particle[] array; if (strarr.Length == 1) { int num = Integer.parseInt(strarr[0]); array = new Particle[num]; for (int i = 0; i < num; i++) { array[i] = new Particle(); } } else { int num = StdIn.readInt(); array = new Particle[num]; for (int i = 0; i < num; i++) { double d = StdIn.readDouble(); double d2 = StdIn.readDouble(); double d3 = StdIn.readDouble(); double d4 = StdIn.readDouble(); double d5 = StdIn.readDouble(); double d6 = StdIn.readDouble(); int r = StdIn.readInt(); int g = StdIn.readInt(); int b = StdIn.readInt(); Color c = new Color(r, g, b); array[i] = new Particle(d, d2, d3, d4, d5, d6, c); } } CollisionSystem collisionSystem = new CollisionSystem(array); collisionSystem.simulate(10000.0); }