Examples of Particle


Examples of org.openpixi.pixi.physics.particles.Particle

   
    ArrayList<Particle> particles = new ArrayList<Particle>();
   
    for (int i=0; i < 100; i++) {
      Particle p = new ParticleFull();
      p.setX(random.nextDouble()*stt.getSimulationWidth());
      p.setY(random.nextDouble()*stt.getSimulationHeight());
      //Assign random integer charge in the range (-10,10)
      //Accuracy decreases with non integer charge, more particles
      //as well as more cells.
      p.setCharge((random.nextInt(20)-10));
      particles.add(p);
    }
   
    InterpolatorAlgorithm interpolation = new CloudInCell();
   
View Full Code Here

Examples of org.openpixi.pixi.physics.particles.Particle

    // We need to translate the position of the particle to the coordinates
    // valid at the neighbor.
    // However, we want the particle to keep its position at the local node.
    // Thus, we need a copy of the particle.

    Particle copy = particle.copy();
    copy.addX(-xoffset);
    copy.addPrevX(-xoffset);
    copy.addY(-yoffset);
    copy.addPrevY(-yoffset);
    sharedData.registerBorderParticle(copy);
  }
View Full Code Here

Examples of org.openpixi.pixi.physics.particles.Particle

      force.bz = - 0.23; // -ConstantsSI.g;
      //force.gy = -1;
      //force.drag = 0.08;
      s.f.add(force);
      s.particles = InitialConditions.createRandomParticles(s.getWidth(), s.getHeight(), s.getSpeedOfLight(), 1, 1);
      Particle par = (Particle) s.particles.get(0);
      par.setX(s.getWidth() * 0.5);
      par.setY(s.getHeight() * 0.5);
      //System.out.println(this.getWidth() * 0.5 + " x0");
      //System.out.println(this.getHeight() * 0.5 + " y0");
      par.setVx(10);
      par.setVy(10);
      par.setMass(1);
      par.setCharge(1);
    }
    else {
      resetAnimation(0);
    }
    s.prepareAllParticles();
View Full Code Here

Examples of org.openpixi.pixi.physics.particles.Particle

      super.paintComponent(graph1);
      reset_trace = false;
    }

    for (int i = 0; i < s.particles.size(); i++) {
      Particle par = (Particle) s.particles.get(i);
      if (par.getCharge() > 0) {
        graph.setColor(Color.red);
      } else {
        graph.setColor(Color.blue);
      }
      double radius = par.getRadius();
      int width = (int) (2*sx*radius);
      int height = (int) (2*sy*radius);
      if(width > 2 && height > 2 && !paint_trace) {
        graph.fillOval((int) (par.getX()*sx) - width/2, (int) (par.getY()*sy) - height/2,  width,  height);
      }
      else {
        graph.drawRect((int) (par.getX()*sx), (int) (par.getY()*sy), 0, 0);
      }
    }

    if(drawCurrentGrid)
    {
View Full Code Here

Examples of org.terasology.logic.particles.BlockParticleEffectComponent.Particle

    }


    private void spawnParticle(BlockParticleEffectComponent particleEffect) {

        Particle p = new Particle();
        p.lifeRemaining = random.nextFloat() * (particleEffect.maxLifespan - particleEffect.minLifespan) + particleEffect.minLifespan;
        p.velocity = random.nextVector3f();
        p.size = random.nextFloat() * (particleEffect.maxSize - particleEffect.minSize) + particleEffect.minSize;
        p.position.set(
                random.nextFloat(-particleEffect.spawnRange.x, particleEffect.spawnRange.x),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.