Skip to content

Latest commit

 

History

History
85 lines (54 loc) · 4.81 KB

File metadata and controls

85 lines (54 loc) · 4.81 KB

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.