Results 1 to 9 of 9
  1. #1
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Particle system.

    So i made a particle class that as X and Y , X and Y direction(where is it moving), , acceleration, life, color and size.
    So i was wonderign how i can make the particles "glow" birgether if the density at soeme coordinate of the image is higher and how can i make em move like in a spiral galaxy only that instead of orbiting, they eventualli reatch the middle.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: Particle system.

    Ok. What's your real question? Because the answer to this one is that you sit down, think about it and you experiment until you get what you want.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: Particle system.

    Like trying some experiments on changing colors to make them glow brighter and dimmer. And I recommend surfing for some equations for various spirals and then practice programming them.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: Particle system.

    I want the particles clump together to look something like this http://www.newscientist.com/data/ima...4431-1_425.jpg. And i want the particles to spawn randomly. But if i use random coordinates, what i get is a cloud of particles that swirls. To make the spiral, i think ialready know the equation, but can i use accseleration for the same purpose? Like i make the accseleration fluctuate betweetn +-a on x and y coordinate.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,785
    Blog Entries
    7
    Rep Power
    21

    Default Re: Particle system.

    Maybe you want to have a look at the theory of attractors; don't go into 'strange attractors'; galactic bodies don't behave like that (Google and Wolfram are your friends here).

    kind regards,

    Jos
    Last edited by JosAH; 07-08-2013 at 10:16 AM. Reason: stupid typo (lack of espresso)
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: Particle system.

    Right... My mind is blown. All these functions and the syntax, only thing i understood was that i had to add something to something, then do a magic dance and add 3 drops of virgin blood. Time to reanimate my brain from the slumber called military service :D and start learning.
    Last edited by vastrolorde; 07-08-2013 at 11:28 AM.

  7. #7
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: Particle system.

    OK, the attractors are difficult and i cand understand how can i use them in my program. Atractor is a set of points in n-dimensional space that evolve into a dynamic system. But only attractor i can find that is explainedis the lorenz attractor, but it is a strange attractor. Havend found any attractors that would resemble anything near what i want it to be. Any glues or tips to share?

  8. #8
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: Particle system.

    Anyone know a attractor that looks like a spiral galaxy? Or have any other ways to greate a similar thing? It should look like a spiral galaxy and the particles should move to the centre of it.

  9. #9
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: Particle system.

    Java Code:
    	for(int i = 0; particle.size() < 5000; i++){
    			double x = randoms(80) +105;
    			double y = randoms(80) +95;
    			Point2D.Double test = new Point2D.Double(x,y);
    			if(raadius.contains(test)&& x != 145 && y!= 135){
    				double x2 = x - mid.getX();
    				double y2 = y - mid.getY();
    				if(x2 < 0) x2 = x2 * -1;
    				if(y2 < 0) y2 = y2 * -1;
    				if(x < mid.getX() && y < mid.getY()){
    					dx = (x2 < y2)? x2 / y2 : 1;
    					dy = (y2 < x2)? y2 / x2 : 1;
    				}
    				else if(x < mid.getX() && y > mid.getY()){
    					dx = (x2 < y2)? x2 / y2 : 1;
    					dy = (y2 < x2)? (y2 / x2)*-1 : -1;
    					}
    				else if(x > mid.getX() && y < mid.getY()){
    					dx = (x2 < y2)? (x2 / y2)*-1 : -1;
    					dy = (y2 < x2)? y2 / x2 : 1;
    					}
    				else{
    					dx = (x2 < y2)? (x2 / y2)* -1 : -1;
    					dy = (y2 < x2)? (y2 / x2)* -1 : -1;
    				}
    				
    				particle.add(new Particle(x,y,0,0,0,0,1,50000));
    				}
    			}
    This code fill my array with particles, eatch withtheir own individual X and Y coordinates.

    Java Code:
    public void cycle() {
    		for(int j = 0; j < particle.size(); j++){
    			if(particle.get(j).update()){
    				particle.remove(j);
    			}
    			else{
    				particle.get(j).setX(2 * (l/360) * Math.cos(l/360) + 145);
    				particle.get(j).setY(2 * (l/360) * Math.sin(l/360) + 135);
    				}
    	
    			}
    		l+=0.1;
    	}
    This should make my particles move.Tha thing under else is a parametrical formula for arichmedes spiral. Problme is, all the particles will go to the same point. Its easyu to but the spiral to move other way around i just have to change l+= into l -= and it works. How to i make this formula work for eatch particle indivivually?, so that eatch particle has its own trajectory?

Similar Threads

  1. Help making a Menu system for Student List System
    By jason3460 in forum New To Java
    Replies: 0
    Last Post: 12-09-2012, 02:39 PM
  2. system.out.printf versus system.out.format
    By bigsonny in forum New To Java
    Replies: 10
    Last Post: 06-21-2011, 11:40 PM
  3. Replies: 8
    Last Post: 06-21-2011, 03:21 PM
  4. Replies: 3
    Last Post: 02-07-2010, 09:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •