Package com.matis_digital.simulation.gui.utils

Examples of com.matis_digital.simulation.gui.utils.Particle


    public void animate()
    {
        for (int idx = 0; idx < size(); idx++)
        {
            final Particle particleA = get(idx);
            for (int nidx = idx + 1; nidx < size(); nidx++)
            {
                final Particle particleB = get(nidx);
                particleA.interact(particleB);
            }
        }
        for (int idx = 0; idx < size(); idx++)
        {
            final Particle particle = get(idx);
            particle.move();
        }
        if (Constants.MUSH == true)
        {
            for (int idx = 0; idx < size(); idx++)
            {
                final Particle particle = get(idx);
                if (particle.isDelete() == true)
                {
                    remove(idx);
                }
            }
        }
View Full Code Here


            final double m = (rand.nextDouble() * 1.0f) + 1.0f;
            final double radius = (rand.nextDouble() * 1.0f) + 1.0f;
            final double sx = (rand.nextDouble() * Constants.SPEED) - (0.5f * Constants.SPEED);
            final double sy = (rand.nextDouble() * Constants.SPEED)- (0.5f * Constants.SPEED);
            /* Add particle to queue */
            final Particle particle = new Particle(_main, size(), color, x, y, m, radius, sx, sy);
            add(particle);
        }
        System.out.printf("Added %d particels \n", size());
    }
View Full Code Here

                _bbGraphics.clearRect(getDisplayX(), getDisplayY(), getDisplayWidth(), getDisplayHeight());
                if (trace == true)
                {
                    for (int idx = 0; idx < _particles.size(); idx++)
                    {
                        final Particle particle = _particles.get(idx);
                        particle.drawTrace(_bbGraphics);
                    }
                }
                for (int idx = 0; idx < _particles.size(); idx++)
                {
                    final Particle particle = _particles.get(idx);
                    particle.draw(_bbGraphics, false);
                    if (info == true)
                    {
                        final FontRenderContext frc = _bbGraphics.getFontRenderContext();
                        final String infoString = particle.toString();
                        final Rectangle2D rect = _bbGraphics.getFont().getStringBounds(infoString, frc);
                        double x = particle.x;
                        double y = particle.y;
                        if (x < getDisplayX())
                        {
                            x = getDisplayX();
                        }
                        if ((x + rect.getWidth()) > getDisplayWidth())
                        {
                            x = getDisplayWidth() - rect.getWidth();
                        }
                        if (y < getDisplayY())
                        {
                            y = getDisplayY() + rect.getHeight();
                        }
                        if ((y + rect.getHeight()) > getDisplayHeight())
                        {
                            y = getDisplayHeight();
                        }
                        _bbGraphics.setPaint(particle.getColor());
                        _bbGraphics.drawString(infoString, (int) x, (int) y);
                    }
                }
            }
            if (stats == true)
View Full Code Here

TOP

Related Classes of com.matis_digital.simulation.gui.utils.Particle

Copyright © 2018 www.massapicom. 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.