|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Collision Detection |
|
![]() Anonymous Poster |
||||
|
||||
| I belive that is a good algorithm. I have been looking for one for a long time now. I came up with something like that a long time ago but it had muy grande problemas. anyway, I guess i can spend another hour or two of my life pulling up my old project and polishing its collision detection. Thanks alot. selen_03@yahoo.com |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
template < class T > const bool &overlaps( const T& x0,const T& y0,const T& x1,const T& y1,const T& x2,const T& y2,const T& x3,const T& y3) const { return ((!( ((x0)<(x2) && (x1)<(x2))|| ((x0)>(x3) && (x1)>(x3))|| ((y0)<(y2) && (y1)<(y2))|| ((y0)>(y3) && (y1)>(y3)) ))); }; |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| dg |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| hi :p |
||||
|
||||
![]() Nyocia Member since: 1/11/2006 From: Tromso, Norway |
||||
|
|
||||
| Thank you for a great article :) |
||||
|
||||
![]() Moe Member since: 1/24/2000 From: Calgary, Canada |
||||
|
|
||||
| Out of curiosity, how did someone manage to resurrect this thread? |
||||
|
||||
![]() aschk Member since: 12/22/2006 |
||||
|
|
||||
| I read the article. Was good. Described it very well. I have a suggestion however. And i'm sure I will probably get told it has it's flaws. When constructing the overlap rectangle. I believe the best thing to do is just to test the center pixel in the rectangle to see if it is overlapping in both bitmaps. Would this not be far more efficient while also giving you some degree of interaction better than just reduced rectangle formula? 1. Saves you of testing all pixels which improves efficiency. 2. gives you a greater degree of collision detection than just reduced rectangles. Let me know your thoughts. I might see if I can sketch some ascii art to represent my point. [Edited by - aschk on December 22, 2006 5:39:56 AM] |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|