Skip to main content

pylygon - 1.2.0rc

a polygon object for python

Chandler Armstrong
a polygon object with rotation and collision detection methods. notable algorithms and implementations: graham-scan convex hull separating axis theorem GJK GJK-based raycast


major release: graham-scan convex hull GJK distance algorithm, suitable for discrete collision detection GJK-based raycast algorithm, suitable for continuous collision detection the release provides examples for each major collision detection method and a profile of all methods. blurb: I originally intended to cease development of pylygon because I had hoped existing polygon libraries would suffice for my needs. I have continued development because the only existing major polygon library for python,, is a clipping library and not sufficient for the demands of continuous collision detection. Major libraries offering continuous collision detection methods, such as chipmunk or Box2D, are not suitable for 'top-down' style games, and cannot model friction with the ground plane, only other objects. Libraries like chipmunk could be made to work with top-view games, but I wasn't happy with the extra baggage brought in with the library; I felt if all I wanted from the library was collision detection I would be better off implementing my own methods. I was also unhappy that no python library seemed to exist that offered implementations of GJK type algorithms. Python is certainly not the ideal language for these algorithms, but python is so well suited at representing an algorithm closest to its pseudo-code form as presented in articles, making Python ideal for learning the algorithms. The GJK algorithms are very fast, and even in Python they are going to be suitable for the vast majority of 2d games. No fully featured polygon collision detection library seems to exist for Python, so I have created pylygon for your development and learning pleasure.


Home Page


pylygon 1.3.0rc — 19 Jan, 2012

pylygon 1.2.0rc — 6 Jul, 2011

pylygon 1.0 — 14 Dec, 2010 account Comments

  • Kaliber64 2012-04-09 12:16

     Finally a simple collision module for python. Making my own has been a nightmare and full of inaccurate hacks.