Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
3d_eight_body_problem.cfg
3d_three_body_problem.cfg
README.md
four_body_problem.cfg
four_body_problem.png
four_body_problem_animated.cfg
mover.py
object_pursuit.py
object_pursuit_3d_view.py
object_pursuit_animator.py
object_pursuit_curve.py
object_pursuit_image.py
three_body_problem.cfg
two_body_problem.cfg

README.md

Pursuit Curve Problem

This snippet of code visualizes the Pursuit Curves between different moving objects, either with an image or an animation. Simulation method has been used instead of mathematical formulation, using the pyglet library for rendering the images.

You can check my blog entry on the problem: Rotpunkt Blog, Pursuit Curves

Getting Started

Clone this repository on your local disk by executing the line below. Be aware you will download other small projects as well

git clone https://github.com/kokomero/miscelanea/

Prerequisites

Install numpy and pyglet packages, these are available in the Python pip repository

Execution

Run the script passing as argument an input file with the description of the problem. Several files are provided for now for different problems. See .cfg files for scenario examples. In the configuration file you can easily setup the initial position of each of the moving object as well as their speed. Likewise, you choose whether you want an animated version of the problem of the resulting final image, as well as setting up parameters such as screen refreshing time.

python object_pursuit_curve.py -i four_body_problem.cfg

The result of the execution should be a windows like the following one, in case we execute the fixed image: Four Body Pursuing Problem

The simulation can be ended by pressing ESC key or closing the window.

Deployment

Just copy the files in a local directory, make sure the required libraries are installed and execute the script following above instructions.

TODOs

  • Implement antialiasing
  • Move line width and colors to the configuration file. Each moving object could have lines linking pursuers and leaders in different colors
  • Define scenarios in 3D space, and be able to rotate the image in 3D
  • Be able to define parametric velocity vector for a leader so that we can implement circular movements

References

Contributing

Feel free to contribute to this piece of code

Authors

License

No licence for this project

Acknowledgments

  • pyglet library