This project is a simple particle simulation implemented in Processing (Java). The particles interact with each other based on a randomly generated interaction matrix, influencing their movement and behavior in a dynamic environment.
- Particle Interactions: Particles are assigned different types, each influencing the movement of others based on an interaction matrix.
- Random Forces: The attraction and repulsion between particles are determined by a randomly generated force matrix.
- Realistic Motion: Particles exhibit smooth motion with velocity damping and collision handling at the boundaries.
- Customizable Parameters: Easily modify the number of particles, interaction strengths, and simulation dimensions.
- Processing (Java Mode)
- Download or clone this repository:
git clone https://github.com/prodev717/particle-simulation.git
- Open the
particle_life.pde
file in Processing. - Click the Run button to start the simulation.
Particle
Class: Represents an individual particle with position, velocity, type, and behavior.interactionMatrix
: Defines how different types of particles interact with each other.setup()
: Initializes the simulation environment and particles.draw()
: Continuously updates and renders the particles on the canvas.
randomForce()
: Generates random attraction/repulsion forces.display()
: Draws the particle on the screen.update()
: Updates the particle's position based on interactions and velocity.
You can modify the following parameters to tweak the simulation:
- Particle count: Change
count = 1000
to increase or decrease the number of particles. - Interaction strength: Modify values inside
interactionMatrix
for different behaviors. - Canvas size: Adjust
size(1200, 900)
insetup()
to change the simulation area.
This project is open-source under the MIT License.