I needed an easy way to draw and modify jointed lines in one of my projects. I wrote this small proof of concept just to test the algorithm.
The goal was to make it easy to add, insert and move joints.
Hint: Everything in this example is pretty basic. The interesting part is when you insert a joint on a line.
- Left click on an empty space to append a new joint.
- Left click on a line to insert a new joint on that line.
- Hold down left mouse button to drag joints.
- Right click on a joint to delete it.
- Press SPACE to toggle visual joints.
- Python - The python programming language.
- PyGame - Game development for Python.
- Algorithm Tutorial - I based my code on this tutorial.
- LinePointDistance - A point to line distance algorithm that I use.
- JointedLine.py - The source code.
- Source code is Public Domain.
Comment this project:
No messages yet.