Message-ID: Date: Thu, 6 Feb 1997 20:37:38 +0000 To: Francois Charton Cc: djgpp AT delorie DOT com From: Shawn Hargreaves Subject: Re: Collison detection fo Action game In-Reply-To: <32FA27A6.3549@pobox.oleane.com> MIME-Version: 1.0 Francois Charton writes: >> sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) < sqrt(r1*r1 + r2*r2). > >Shouldn't it be : >sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) < r1 + r2 Oops: you are absolutely right! I should test code before posting it, sorry everyone... But my point about leaving out the square root still holds: sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) < r1+r2 can be reduced down to: (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) < (r1+r2)*(r1+r2) /* * Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ * Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'. */