[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Line Collision



Shapely (http://toblerity.org/shapely/manual.html ) is a Python library with functions for things like 'do these two shapes intersect?' I don't know if building the Shapely objects is quick enough to be done during a game, but it's worth a try.

On 18 November 2017 at 18:55, bw <stabbingfinger@xxxxxxxxx> wrote:
It seems so simple a problem to our eyes. But it's computationally a non-trivial problem. You can find algorithms on the web mostly in other languages and convert them to Python, like I did here.

https://bitbucket.org/gummbum/gummworld2/src/200e9350acca33d40b0c41c9e74c0eaeb6079061/gamelib/gummworld2/geometry.py?at=default&fileviewer=file-view-default#geometry.py-151

I would love to see this stuff in a native lib. I might do it myself but...Windows.



On 11/18/2017 8:26 AM, gabrielslomka@xxxxxxxxx wrote:
Hey, supose i have a Rect and a Line, i just want to see if the line intercepts the rect, is that possible somehow in a kind of optimized way ? Im having trouble implementing this.

Thanks in advance !