Skip to content

A highly customizable non-deterministic particle simulation.

Notifications You must be signed in to change notification settings

cruzfelipee/ParticleSimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Particle Simulator

A highly customizable non-deterministic particle simulation that uses multithreading and grid hashing for extra performance.

Features

  • Particle creation and management
  • Gravity and drag effects
  • Collision detection and resolution
  • Multi-threaded updates for improved performance
  • Visualization using Java Swing

Getting Started

Prerequisites

  • Java Development Kit (JDK) 8 or higher

Installation

  1. Clone the repository:

    git clone https://github.com/cruzfelipee/ParticleSimulator.git
    cd ParticleSimulator
  2. Open the project in your preferred IDE.

  3. Build the project to resolve dependencies.

Running the Simulation

  1. Navigate to the App class in App.java.

  2. Run the main method to start the simulation.

Configuration

You can configure the simulation parameters in the App.java file:

Project Structure

  • Main: Contains the main application entry point.
  • Services: Contains services for handling various aspects of the simulation (e.g., gravity, collisions, boundaries).
  • Structures: Contains data structures used in the simulation (e.g., Particle, Vector2, Grid).
  • Tools: Contains utility classes (e.g., ParticleDrawer, ParticleHeightComparator).

Classes Overview

Main

  • App: The entry point of the application. Initializes and runs the simulation.
  • Simulator: Manages the simulation, including updating particle positions and velocities.

Structures

  • Particle: Represents a particle in the simulation.
  • Vector2: Represents a 2D vector with various vector operations.
  • Grid: A spatial grid for efficient neighbor searching.

Tools

Acknowledgements


NOTE: The algorithm is meant to run at a variable framerate, which can lead to unexpected behaviour and will create a different simulation every time you execute the program.

About

A highly customizable non-deterministic particle simulation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages