Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

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


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


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


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


  • 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



Feel free to contribute to this piece of code



No licence for this project


  • pyglet library