GPWiki.org
GPWiki.org
It is currently Mon May 20, 2013 3:36 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 07, 2012 3:52 am 
On page http://content.gpwiki.org/index.php/Polygon_Collision there is some, probably, wrong info. In section about non-convex objects described algorithm, which suggests to perform point-in-polygon test for each vertex of another polygon. But if we find that no vertex lies inside polygon, it means nothing. For example, take a look at character '+'. Plus consists of two axes-oriented boxes (polygons). Every vertex is outside boxes. But polygons collides.

This algorithm will work correctly under some conditions: if we check for collision every STEP seconds, we know that at STEP seconds before now polygons didnt collides, and we know that maximum speed of any object multiplied by 2*STEP is lower then minimum "width" of object. "Width" in this context needs separate definition, but I'm not strong in English, and I think that my attempts to define this will not give you a clearer undestanding but, on the contrary, will perplex you. =)

If we needs some extremly simple, but always giving true results, then we need to check for collision each pair e1, e2, where e1 some is edge of polygon #1, and e2 is edge of polygon #2. But this is not so fast. This approach have O(m*n) complexity, where m and n are numbers of vertices of polygons.


Top
  
Reply with quote  
PostPosted: Fri Sep 07, 2012 8:23 am 
Bibliotherapist
User avatar

Joined: Wed Nov 03, 2004 1:28 pm
Posts: 6706
Location: Lincoln, Englandshire
Hi there, welcome to GPWiki.

The bulk of that article was written back in 2009. I must admit I've never read it in any depth as I've never had a need to do that kind of work. If you want to correct the text, drop me a PM and I'll create a wiki account for you (our registrations are locked down due to spam).

_________________
10 PRINT "Bad Monkey ";
20 GOTO 10


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 07, 2012 5:21 pm 
Shake'n'Baker

Joined: Sun May 27, 2012 6:01 pm
Posts: 62
The article says that point in polygon should be used as a preliminary test as it is fast and provides additional information. It does go on to say to use edge detection and provides a code example of edge collision.

What is it you think is wrong with it?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group