JointedLine
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.
Example usage
- 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.
Screenshot
Related links
- 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.
Downloads
- JointedLine.py - The source code.
Copyright notice
- Source code is Public Domain.
Comment this project:
No messages yet.
