You cross the normals to get the intersection line direction
then you find an arbitrary point that the both planes share
and you get an origin for the line.
I read that, but I took to a piece of paper to do the algebra and
im not quite good enough at it to do it, can anyone point me
to a piece of code that does it that I can just insert into my
program?
If its too much trouble dont worry about it, im looking right now
and have been unsuccesful so far.
2 plane intersection
Started by rouncer, Nov 18 2007 12:31 PM
10 replies to this topic
#1
Posted 18 November 2007 - 12:31 PM
#3
Posted 18 November 2007 - 01:43 PM
thanks alot i used the one there, i had to grab it out of a whole library.
But I found it eventually and it worked.
But I found it eventually and it worked.
#4
Posted 18 November 2007 - 05:14 PM
Basically:
lineDir = cross(a.normal, b.normal); p = a.normal * a.distance; // arbitrary point on plane A v = cross(lineDir, a.normal); // direction toward plane B, parallel to plane A lineOrigin = rayPlaneIntersection(b, p, v);
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
#5
Posted 19 November 2007 - 06:50 AM
Is that one as quick as the 2 unknowns version?
Ill save it on my computer anyway, pretty clever.
Ill save it on my computer anyway, pretty clever.
#6
Posted 03 January 2008 - 02:06 PM
thanks for this, its what I was looking for too,
however im doing polygon-polygon intersection,
as part of polyhedron-polyhedron intersection,
If I get a line that is the intersection, I then have to test for where this line crosses with each wire in each polygon, I think its possibly quicker to leave it as the way I have it at the moment wich is to test each wire in each polygon to see where it intersects the other polygon, as lineIntersectplane is quicker than lineInterscetline.
Unles anyone has any other ideas ?...
however im doing polygon-polygon intersection,
as part of polyhedron-polyhedron intersection,
If I get a line that is the intersection, I then have to test for where this line crosses with each wire in each polygon, I think its possibly quicker to leave it as the way I have it at the moment wich is to test each wire in each polygon to see where it intersects the other polygon, as lineIntersectplane is quicker than lineInterscetline.
Unles anyone has any other ideas ?...
#7
Posted 04 January 2008 - 11:29 PM
If you're doing a polyhedron-polyhedron intersection, you should use a separating axis test, it's a lot quicker than what you're trying to do.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
#8
Posted 11 January 2008 - 04:05 PM
thanks is there an easy explanation of this ?
or even some code ?
im having quite a hard time doing this csg building,
the libraries seem to stop well short of doing this sort of thing,
or they are part of complete packages wich are hard to follow the bits that I need, and many of the explanations seem to go over my head ...
the way Ive done it doesnt seem to take too long, the problem I have atm is that I have a surface wich is intersected by many models and results in 2000 intersection lines, of wich 700 are reflex points and I need to add lines so i can produce a list of convex polygons. (its a realy realy huge maze).
it fixes it but takes about a minute.
its like a massive join the dots puzzle, wich would be easy if I could just do it as I see it ...
or even some code ?
im having quite a hard time doing this csg building,
the libraries seem to stop well short of doing this sort of thing,
or they are part of complete packages wich are hard to follow the bits that I need, and many of the explanations seem to go over my head ...
the way Ive done it doesnt seem to take too long, the problem I have atm is that I have a surface wich is intersected by many models and results in 2000 intersection lines, of wich 700 are reflex points and I need to add lines so i can produce a list of convex polygons. (its a realy realy huge maze).
it fixes it but takes about a minute.
its like a massive join the dots puzzle, wich would be easy if I could just do it as I see it ...
#9
Posted 11 January 2008 - 05:02 PM
Basically
There's a lot of info regarding the separating axis test on the internet. Just google for it.
bool SATest(object a, object b, vector3 v)
{
float minA, maxA, minB, maxB;
a.ProjectOnAxis(v, &minA, &maxA);
b.ProjectOnAxis(v, &minB, &maxB);
// test for overlap
return maxB > minA && maxA > minB;
}
bool IntersectionTest(object A, object B)
{
// test each plane of A
for each (Plane p in a.GetPlanes())
{
if (!SATest(a, b, p.GetNormal())
return false;
}
// test each plane of B
for each (Plane p in b.GetPlanes())
{
if (!SATest(a, b, p.GetNormal())
return false;
}
// test each combination of edges of A and B
for each (Edge eA in a.GetEdges())
{
for each (Edge eB in b.GetEdges())
{
vector3 v = Cross(eA.GetDir(), eB.GetDir());
if (!SATest(a, b, v))
return false;
}
}
return false;
}
There's a lot of info regarding the separating axis test on the internet. Just google for it.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
#10
Posted 28 March 2008 - 12:55 PM
Hey if I'm just doing plane-plane, tri-tri, tri-plane intersection.
Would it be silly to use the separating axis test? since its slower than these types of intersection?
Would it be silly to use the separating axis test? since its slower than these types of intersection?
#11
Posted 28 March 2008 - 02:23 PM
A plane is not a convex polytope, so you can't so SATs with planes. Besides, the only thing you need to test with a tri-plane intersection is whether all three verts of a tri are on the same side of the plane.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.
-
Currently working on: the 3D engine for Tomb Raider.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












