Giter Site home page Giter Site logo

cano-jones / 2d-physics-engine Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 79.91 MB

Physics_Engine is a python library that allows users to create simple yet realistic simulations of collisions between massive circles and line segments within some boundary conditions.

License: Other

Python 100.00%

2d-physics-engine's Introduction

Physics_Engine is a python library that allows users to create simple yet realistic simulations of collisions between massive circles and line segments within some boundary conditions.

This library provides two main object classes: 'Particle' and 'Line'. Given a set of particles and line segments the main 'Engine' function creates a real-time simulation and graphic animation of the interaction between particles and lines.

Particles will bounce off other particles, lines or boundaries according to newtonian mechanics, preserving energy thanks to the implementation of a Verlet algorithm used to move the particles.

Forwarding
Pachinko

Routing
Closed Circle Boundary

In order to create a particle 'p' one must procede to inicializate as follows

p = Particle(Position, Velocity, Mass, Radius, Color, Dynamic)

In order to create a line segment 'l' one must procede to inicializate as follows

l = Line(Point_A, Point_B)

The environment in which the objects exist must be determined by the user, this includes:

  • Window_Size: Size of the window screen in pixels
  • Background: Function comprised of pygame code to draw anything on the screen background
  • Boundary: Function that changes the position and velocity of particles defining some boundary
  • Force: Function that describes the force felt by a particle

The library includes some predefined functions that could be used to describe the environment

  • Boundaries:
    • Closed_Box_Boundary
    • Periodic_Boundary
    • Closed_Circle_Boundary
  • Circle_Boundary_Background
  • Const_Gravity

This python library allows multiple aplications, including physics simulations with real educational value, a great example might be the simulation presented bellow, with two gases separated by a chamber, blue particles have greater average velocity than red particles. This could be used to demonstrate principles in thermodinamics and statistical physics

Routing
Two Gases

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

2d-physics-engine's People

Contributors

cano-jones 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.