Dead Hackers Society
Other BBSes »
 
 
Demoscene   Coding   CT60   Buy/sell

Atari demoscene BBS
 
Re: Collision detection
Posted by: ray Jul,29.2004-20:01 

hiya bod,

imagine your 2d object's outline is made up of a polygon (which needs to be convex imo) and its vertexes are defined in a fixed order (either CW or CCW).
if you now want to check for collisions between a point and an object simply loop through all of the corresponding polygon's edges (=lines) and categorize by the sign of distance between this point and each line (ie. + or - , the distance's value doesn't matter).
depending on how you chose your vertex definition direction a point is in/outside of an area if it the signtest gave the same result for every edge.

hope this explanation isn't too sloppy

regards,
ray







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
Collision detection Bod/STAX Jul,29.2004-19:27
  Re: Collision detection Bod/STAX Jul,29.2004-19:28
    Re: Collision detection ray Jul,29.2004-20:01
    Re: Collision detection Patrice Mandin Jul,30.2004-17:21
  Re: Collision detection Patrice Mandin Jul,29.2004-20:40
    Re: Collision detection Bod/STAX Jul,29.2004-21:00
    Re: Collision detection Bod/STAX Jul,29.2004-21:11
      Re: Collision detection Patrice Mandin Jul,30.2004-10:57
        Re: Collision detection Bod/STAX Jul,30.2004-13:07
          Re: Collision detection gwem Jul,30.2004-13:20


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2025 Dead Hackers Society Contact: Anders Eriksson