[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: SV: Re: [pygame] Pixel perfect collision detection sugestion
On Fri, Sep 09, 2005 at 09:29:21AM +0100, John Eriksson wrote:
> Njaeee...
>
> > "...probably also be faster than the rect-based one we have now..."
>
> Theoretically circle algorithms are always more expensive than the
> rectangular ones (if you dont start to rotate the rectangles *smile*).
>
> In real life though...the theoritical trade off can be ignored. ;-)
>
> /John
Normally circle algorithms are slow, but colision detection between
circles needs not be. Because you only care about collision, and not
specific distance, you can skip the square-root step of the pythagoran
theorum, making it hella faster. Circle collision is every bit as simple
and fast as rectangle collision.
---
Bob the Hamster