www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/06/20:02:02

Message-ID: <caXkRSASEk+yEwC9@talula.demon.co.uk>
Date: Thu, 6 Feb 1997 20:37:38 +0000
To: Francois Charton <deef AT pobox DOT oleane DOT com>
Cc: djgpp AT delorie DOT com
From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Subject: Re: Collison detection fo Action game
In-Reply-To: <32FA27A6.3549@pobox.oleane.com>
MIME-Version: 1.0

Francois Charton <deef AT pobox DOT oleane DOT com> 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'.
 */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019