Giter Site home page Giter Site logo

gravitysimulation's Introduction

The particle gravity simulation project in Java Swing is an implementation of a model that simulates the movement of particles under the influence of gravitational force. Two solutions are implemented within the project: "brute force" and "quad tree".

The "brute force" solution is a simple approach to simulating gravity that relies on the direct calculation of forces between each particle and every other particle in the simulation. This method is quite easy to implement, but has a quadratic complexity, which means that for each particle in the simulation, the presence of every other particle must be calculated, which can become very slow as the number of particles in the simulation increases.

The second solution used in this project is the "quad tree" algorithm. This algorithm is used to optimize the simulation by reducing the number of force calculations between particles. The quad tree is a tree consisting of four quadrants that are divided into sub-quadrants and so on until each square can contain only one particle. This algorithm allows to avoid the calculation of forces between particles that are far away from each other, resulting in a faster simulation.

In the implementation of the project, Java Swing is used to display the simulation on the screen, and the user can set various parameters such as the number of particles, speed, size, and initial position of the particles. When the simulation is started, the user can see how the particles move under the influence of gravitational forces and how their position changes over time.

GravitySimulation.2023-04-11.10-03-37.mp4

gravitysimulation's People

Contributors

nemanja1105 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.