Collision (cringe) between 2 planes

Member
Posts: 40
Joined: 2002.04
Post: #1
Does anyone know of a good algorithm to test for collision between two planes? I've done a quick google search but came up with nothing useful..

Any response welcome.
Cheers.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #2
I wonder if you're searching for the right thing. You wouldn't normally want to detect a collision between two planes because any two non-parallel planes will always 'collide' somewhere (planes are infinitely large). You might want to look for the line of intersection, though.

Alternatively, maybe you mean that you want to detect a collision between two triangles (or other polygons). You might have more luck searching for 'collision triangles' instead.

I don't know of any such algorithms off the top of my head though. I found a fast ray-triangle collision test routine once, but I can't remember what it's called. I can look it up later if you're interested.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #3
Dave Eberly's "Wild-Magic" is now up to version 1.5 - including new code to support Jaguar. Also anyone can now d/l the code - no more password. If you find the code useful - you should purchase the book. I have the book and its a lifesaver - I use the "Free-Magic" part of the codebase all the time.

http://www.wild-magic.com/SourceCode.html

I think that there are only CodeWarrior 8 project files - unfortunately no Project Builder files. But if you dont have CW you can always do what I did - which is download the linux version and build it from the makefile.

Anyway - plenty of collision and intersection code. Including a find function for getting the line that two planes intersect. Look for the "MgcIntr3DPlnPln.cpp" file in the "Intersection3D" directory.

There is also collision and intersection code for spheres, toruses, lozenges, frustums, cones, capsules, triangles, oriented-boxes. Lots o the good stuff.

hth,
Codemattic
Quote this message in a reply
Member
Posts: 40
Joined: 2002.04
Post: #4
Thanks NCarter, you're right. I had forgot that planes technically are infinite.

What I meant was, I need to find out when two 2D rectangles collide in 3D space.

Thanks for the link, Codemattic, but I'm using realBasic for now. If I can't find anything else I will give that a whirl. As soon as my final exams finish this week, I'm going to lock myself up in my room and learn a REAL language! Cocoa! I'm looking forward to it Smile

Anyway, is there a simple and fast algorithm of detecting collisions between 2D rectangles in a 3D world?

Thanks
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #5
same advice as before. All the algorithms are there.


Intersection and collision are similar but different. For collision you have two (or more) objects that start out presumably not intersecting - but you calculate th first time/point of intersection based on their velocities, accelerations and rotations - which is much harder than just intersections.

(Im guessing - I havent fully worked this out) - but for any two 2D concave polys in 3D - I would just check each point of each polygon against the plane of the other polygon. If each polygon bisect the other's plane - then they must intersect. This wouldnt be able to test if they were both on the same plane tho.

-Codemattic
Quote this message in a reply
Sta7ic
Unregistered
 
Post: #6
Would it work to calculate the equation for the line of the two planes that the polygons rest on and test polygon points through said equation and determine if the tested points are ordered (far point and close point of ABCD less than n while close point then far point of EFGH) or out of order (far ABCD and near EFGH less than n, near ABCD and far EFGH greater than n)?

(it's midnight, so reason may shuffle this completely off the forum)

-Sta7ic Matt
Quote this message in a reply
ededed
Unregistered
 
Post: #7
Here is a fantasticly brilliant website
http://astronomy.swin.edu.au/~pbourke/
click on geometry, there is a page on plane intersection as well as loads of other shapes and problems.
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #8
Just off the top of my head, and this is probably not the fastest way but is the most obvious, would be to check for intersections of each line segment on one rectangle against the plane of the other, then check the point at which the line hits the plane and see if it is inside the rectangle in 2D space.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Question regarding planes TomorrowPlusX 3 2,092 Aug 1, 2008 02:38 AM
Last Post: DoG