delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/29/01:09:25

From: "John M. Aldrich" <fighteerNO AT SPAMcs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Collision Detection
Date: Mon, 28 Apr 1997 10:58:11 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 24
Message-ID: <336482C3.6092@SPAMcs.com>
References: <MPG DOT dcddb78f470c89c98968a AT news DOT demon DOT co DOT uk> <Pine DOT SV4 DOT 3 DOT 94 DOT 970428125700 DOT 28102C-100000 AT aludra DOT usc DOT edu> <5k3lbt$2es_002 AT fmsc DOT com DOT au>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp103.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Peter Monks wrote:
> 
> Actually, you can skip the square root operation by just comparing the
> distances *squared* between objects, rather than the actual distance.  I
> think this makes this approach even faster than the bounding box method.
> Don't quote me in this, however, since I haven't actually tested whether its
> faster or not!
> 
> Note that this approach still isn't pixel-accurate, but if your sprites are
> generally circular, it will yield better results than bounding box detection.

Of course, you can also use the bounding circle algorithm to see if
sprites are in _proximity_ to one another, and only then run a bit by
bit comarison.  Saves time and maximizes accuracy.  ;)

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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