Sign in to follow this  
dawidjoubert

Help understanding formula (3 plane intersection)

Recommended Posts

hi there, so the unique intersection point of a plane is given by [pic]http://softsurfer.com/Archive/algorithm_0104/Eqn_3planes.gif[\pic] So the way i understand it is that we have 3 planes plane 1 ,plane 2,plane 3 n1,n2,n3 are vectors and they store A,B,C in the correct place like this -- Plane-1 = Ax + By + Cz = -D n1.x = A n1.y = B n1.z = C d1 = D okay and then it can be all worked out except how do you multiply n2 by n3 now you could use the dot product but as the picture shows the dot product is shown by a . Here is the formula in text:
                   -d1(n2*n3) -d2(n3*n1) -d3(n1*n2)
Point (Vector) = ------------------------------------
                             n1.(n2*n3)
[\source]

Share this post


Link to post
Share on other sites
the little 'x' operator among the normal vectors denotes the cross product, which is one of the most fundamental operation you can perform on 3d vectors. Unlike the dot product which yields a real number, this one yields a vector which is normal to the plane of the operands.

It's formula is v1Xv2 = |v1|*|v2|*sin(phi)*n, where n is a vector normal to the plane of v1,v2 and points to the direction necessary, in order for {v1,v2,n} to form a right-handed system (if you are in a right-handed reference system) or vice-versa.

This formula isn't the most useful form. There is another one involving the actual components of the vectors.

Let v1=(x1,y1,z1), v2=(x2,y2,z2), then their cross product is
V = (v1)x(v2) = {y1*z2 -y2*z1, x2*z1 - x1*z2, x1*y2 -x2*y1}

Do you know what type of 3d coordinates system you're using? left handed/right handed? You'll probably need that sooner or later.

Share this post


Link to post
Share on other sites
Btw, some common properties of the cross product that you may need:

1) v1 x v2 = - v2 x v1

2) If c is a scalar number
(c*v1)x(v2) = (v1)x(c*v2) = c*(v1 x v2)

3) v1 x (v2 + v3) = (v1 x v2) + (v1 x v3)
therefore also: (v2 + v3) x v1 = (v2 x v1) + (v3 x v1)

Share this post


Link to post
Share on other sites
This uses a slightly different formulation of the intersection formula you posted a link to, but because you seem to be looking for code, here's one implementation:


// Compute the point p at which the three planes p1, p2, and p3 intersect (if at all)
int IntersectPlanes(Plane p1, Plane p2, Plane p3, Point &p)
{
Vector u = Cross(p2.n, p3.n);
float denom = Dot(p1.n, u);
if (Abs(denom) < EPSILON) return 0; // Planes do not intersect in a point
p = (p1.d * u + Cross(p1.n, p3.d * p2.n - p2.d * p3.n)) / denom;
return 1;
}



Cross() and Dot() are the cross product and dot product, respectively, of two vectors. If you are not familiar with them (which you really need to be if you are going to be working with planes and vectors) you can google for the terms (or better, get an introductory textbook on "Elementary Linear Algebra"; a used one you can get for just a few bucks, if that).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this