Lorenz, I believe that would circle be caught by the code, because the "side" collide condition is on an OR basis. So if the circle center is vertically within the rect (your circle), OR horizontally within the rect, it will return True. That seems to cover most cases of intersection in a pretty clever way that looked like a bug to me at first too. In any case, it looks to me like any time the circle center is outside the rect in both directions will demand corner intersection for a possible collision, and thus all the collisions are caught.
I think that in retrospect, the only bug (that I fixed already in the code) was a mistake in initial conditional testing for rectangle collisions. Joe On Fri, Mar 25, 2011 at 9:56 AM, <[email protected]> wrote: > Hey, > > as Joe said: there are several bugs. > for example it will miss the collision of this setup: > > circle: > radius = 10 > x, y = 10, 10 > > rect: > x, y = 15, 5 > w, h = 10, 10 > > I hope that is correct (I just did the example in my head). > The circle should be next to the rect cutting the same side of the rect > twice. > The code only seems to check if the center of the circle is inside the rect > or if any of the corners are inside the circle. > > sincerely yours, > Lorenz > > > > On Fri, 25 Mar 2011 11:40:59 +0000, René Dudfield <[email protected]> > wrote: > >> Hi, >> >> I think it's a circle rect collision function. >> >> >> On Fri, Mar 25, 2011 at 11:30 AM, Joe Ranalli <[email protected]> wrote: >> >>> Was there any background on the purpose of that code? It seems at a >>> glance >>> like there's several bugs. >>> >>> On Fri, Mar 25, 2011 at 4:39 AM, René Dudfield <[email protected]> wrote: >>> >>>> >>>> Hey, >>>> >>>> I noticed someone on irc left some code... but they aren't on irc any >>>> more, and I wasn't around when they mentioned the code. >>>> >>>> The code is here: >>>> http://collabedit.com/exb5k >>>> >>>> Want to discuss it here? >>>> >>>> >>>> >>>> cya. >>>> >>> >>> >>> >
