masterbooda
Swordmaster
277 Posts |
Posted - May 15 2004 : 01:09:03 AM
|
Ok......... real simple.........can anybody help me with this... I have two 4 sided polygons, all I need to know is of a method or the math needed to detect if they are overlapping...
I was using gdi32 calls for this, and even after fixing the memory leak issues........it was still to slow........I have looked high and low for articles on this and everyone is using the gdi calls and the math tutorials where well above this uneducated man's head........
Could somebody point me to something........or explain the math in layman(i'm a blithering idiot) language....... The closest article I found was on line intersection......and it doesn't work in all instances.....
Any help would be appreciated..... and I will remain calm and civil....
DaBooda out..... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
VBBR
Moderator
Brazil
617 Posts |
Posted - May 15 2004 : 06:01:25 AM
|
Try this article from DirectX4VB, it's for collisions in 3D but I think it can be adapter to 2D easily.
|
Whatever. Who knows... |
|
|
Sr. Guapo
Swordmaster
USA
272 Posts |
|
masterbooda
Swordmaster
277 Posts |
Posted - May 15 2004 : 11:03:13 PM
|
Yeah that works for rectangles, but I have irregular polygons....... I was needing an actual algorithm to detect the intersection of these two.... I have been using line intersection, but it is slow and even if all I detect is just whether or not the lines intersect..... still slow......
I then switched over to using very simple circle collision... which is just one line of code..... still pretty slow..... but of course my processer is slower than my grandmother on a rainy day...
And circular collision isn't very accurate...... I was hoping to find a better algorithm... I could take this and write it in c++ and use it that way... but I'm pulling my hair out finding something...
I need something that covers all bases, that way there is no error...... Its for my dabooda2dturbo engine.....
DaBooda out... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Sr. Guapo
Swordmaster
USA
272 Posts |
Posted - May 15 2004 : 11:11:29 PM
|
There are all sorts of different shortcut collision detection methods. Circles are the easy, but don't usually fit well. Same with rectangles. There ae even ways to use ellipses (rather than circles), if those fit better, though I don't know how. It probably involves some complex math, however. |
|
|
Brykovian
Bryk the Cheese Slayer!
USA
58 Posts |
|
masterbooda
Swordmaster
277 Posts |
Posted - May 16 2004 : 06:59:04 AM
|
Thanks, those really helped....... I figured out how to cut the math in half, by not squaring the result...... thanks again..
DaBooda out...
|
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Chris
Neophyte
Australia
1 Posts |
Posted - Jul 01 2004 : 03:17:59 AM
|
Hi, DaBooda. I'm not too sure what you intend to do, but if you're looking for Pixel Perfect Collision Detect in DirectDraw, VB, then here's a tutorial i'd like to refer you to: http://rookscape.com/vbgaming/tutAS.php. This only works for 8-Bit, but in the message board there is a way of fixing it for 16-bit. For any more help, email me on: drewboy_notyou@hotmail.com. Good luck! Chris |
|
|
game_maker
Knave
Saudi Arabia
83 Posts |
Posted - Jul 02 2004 : 4:43:08 PM
|
Hi
hmmmmm ,, divide on polygon into 2 traingles
then find if any point of the other polygon is lies on any of the 2 traingles
this means you have to test point in traingle 16 times
and here is a code of point in traingle
Download Attachment: triangle.zip 3.89 KB
regards
|
Edited by - game_maker on Jul 03 2004 03:36:54 AM |
|
|
Sion
Warrior
Denmark
138 Posts |
|