Re: Circle - Square Collision Detection
- From: Miss Elaine Eos <Misc@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Oct 2007 14:35:19 GMT
In article <jKeRi.13363$JD.3817@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
John Nagle <nagle@xxxxxxxxxxx> wrote:
guitarstrummr@xxxxxxxxx wrote:
Anyone have any quick and simple code for collision detection between
a circle and a square?
Check the distances between the centers first; eliminate the case
where the circle and square are far enough apart that they can't
possibly touch. After that, do a signed point to line distance calculation
for each edge of the square vs. the center of the circle. If the
signed distance is less than the radius of the circle for all edges,
you have a collision.
If the signed distance is less for ANY edge of the square, right? "All
edges" gives you "square contained in circle" -- right?
(Just checking...)
--
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
.
- Follow-Ups:
- Re: Circle - Square Collision Detection
- From: John Nagle
- Re: Circle - Square Collision Detection
- References:
- Circle - Square Collision Detection
- From: guitarstrummr@xxxxxxxxx
- Re: Circle - Square Collision Detection
- From: John Nagle
- Circle - Square Collision Detection
- Prev by Date: Re: Circle - Square Collision Detection
- Next by Date: Re: Circle - Square Collision Detection
- Previous by thread: Re: Circle - Square Collision Detection
- Next by thread: Re: Circle - Square Collision Detection
- Index(es):
Relevant Pages
|
Loading