@Override public void onRun() { Location location = getLocation(); for (int j = 0; j < stepsPerIteration; j++) { if (step % particles == 0) { rndF.clear(); rndAngle.clear(); } while (rndF.size() < arcs) { rndF.add(RandomUtils.random.nextFloat()); } while (rndAngle.size() < arcs) { rndAngle.add(RandomUtils.getRandomAngle()); } for (int i = 0; i < arcs; i++) { float pitch = rndF.get(i) * 2 * this.pitch - this.pitch; float x = (step % particles) * length / particles; float y = (float) (pitch * Math.pow(x, 2)); Vector v = new Vector(x, y, 0); VectorUtils.rotateAroundAxisX(v, rndAngle.get(i)); VectorUtils.rotateAroundAxisZ(v, -location.getPitch() * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -(location.getYaw() + 90) * MathUtils.degreesToRadians); display(particle, location.add(v)); location.subtract(v); } step++; } } }
rotateAroundAxisX(v, angleX); rotateAroundAxisY(v, angleY); rotateAroundAxisZ(v, angleZ);
@Override public void onRun() { Location location = getLocation(); float radius = 3 * innerRadius / MathUtils.SQRT_3; for (int i = 0; i < spikesHalf * 2; i++) { double xRotation = i * Math.PI / spikesHalf; for (int x = 0; x < particles; x++) { double angle = 2 * Math.PI * x / particles; float height = RandomUtils.random.nextFloat() * spikeHeight; Vector v = new Vector(Math.cos(angle), 0, Math.sin(angle)); v.multiply((spikeHeight - height) * radius / spikeHeight); v.setY(innerRadius + height); VectorUtils.rotateAroundAxisX(v, xRotation); location.add(v); display(particle, location); location.subtract(v); VectorUtils.rotateAroundAxisX(v, Math.PI); VectorUtils.rotateAroundAxisY(v, Math.PI / 2); location.add(v); display(particle, location); location.subtract(v); } } }
@Override public void onRun() { Location location = getLocation(); for (int x = 0; x < circles; x++) { for (int i = 0; i < helixes; i++) { double angle = step * radials + (2 * Math.PI * i / helixes); Vector v = new Vector(Math.cos(angle) * radius, step * grow, Math.sin(angle) * radius); VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians); location.add(v); display(particle, location); location.subtract(v); } step++; } }
protected void drawParticle(Location location, Vector v, Particle particle, Color color) { VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians); location.add(v); display(particle, location, color); location.subtract(v); }
@Override public void onRun() { Location location = getLocation(); for (int x = 0; x < particles; x++) { if (step > particlesCone) { step = 0; } if (randomize && step == 0) { rotation = RandomUtils.getRandomAngle(); } double angle = step * angularVelocity + rotation; float radius = step * radiusGrow; float length = step * lengthGrow; Vector v = new Vector(Math.cos(angle) * radius, length, Math.sin(angle) * radius); VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians); location.add(v); display(particle, location); location.subtract(v); step++; } } }
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < particlesNucleus; i++) { Vector v = RandomUtils.getRandomVector().multiply(radius * radiusNucleus); location.add(v); display(particleNucleus, location, colorNucleus); location.subtract(v); } for (int i = 0; i < particlesOrbital; i++) { double angle = step * angularVelocity; for (int j = 0; j < orbitals; j++) { double xRotation = (Math.PI / orbitals) * j; Vector v = new Vector(Math.cos(angle), Math.sin(angle), 0).multiply(radius); VectorUtils.rotateAroundAxisX(v, xRotation); VectorUtils.rotateAroundAxisY(v, rotation); location.add(v); display(particleOrbital, location, colorOrbital); location.subtract(v); } step++; } }
v.setX(a).setY(a); v.setZ(edgeLength * p / particles - a); VectorUtils.rotateAroundAxisX(v, angleX); VectorUtils.rotateAroundAxisY(v, angleY);