Collision (cringe) between 2 planes
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.
Any response welcome.
Cheers.
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.
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.
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
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
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
Anyway, is there a simple and fast algorithm of detecting collisions between 2D rectangles in a 3D world?
Thanks
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
Anyway, is there a simple and fast algorithm of detecting collisions between 2D rectangles in a 3D world?
Thanks
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
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
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
(it's midnight, so reason may shuffle this completely off the forum)
-Sta7ic Matt
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.
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.
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.
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Question regarding planes | TomorrowPlusX | 3 | 3,270 |
Aug 1, 2008 02:38 AM Last Post: DoG |