Let the two planes be Dot(N0,X) = d0 and Dot(N1,X) = d1
where N0 and N1 are unit length vectors. Define
p = Dot(N0,N1). The line of intersection of the two planes
has (not-necessarily-unit-length) direction vector
Cross(N0,N1)
and contains the point
[(d0-p*d1)*N0 + (d1-p*d0)*N1]/(1-p^2)
--
Dave Eberly
ebe...@magic-software.com
http://www.magic-software.com
Dave Eberly wrote:
I undertstand how you got the direction vector, but how did you get the
point?
William Scarboro
I constructed it by finding a point on one plane (d times the normal
will give you one) and then adding in the distance you need to travel
in that plane to get to the other plane (remembering to Gram-Schmit
the vector you're traveling so you won't step out of the first plane).
Another way to do it is to solve the 2x3 underconstrained linear
system given by the two constraints, n1.p+d1=0 and n2.p+d2=0. This
gives you a matrix equation you can solve and get the explicit
equation for p in terms of the one free degree of freedom (since it's
a line). I don't know if there's a groovy symbolic way to do that
without resorting to writing vector elements, though.
Chris
Sent this by email to William, didn't know he posted also.
The line of intersection is of the form X(t) = t*N0xN1+ P for some
point P. Assuming that N0 and N1 are not parallel, the three vectors
N0, N1, and N0xN1 are linearly independent. That means that P
can be written as a linear combination of them,
P = a*N0 + b*N1 + c*N0xN1
and
Dot(N0,P) = a*Dot(N0,N0)+b*Dot(N0,N1)+c*Dot(N0,N0xN1)
= a*1 + b*d where N0 is unit length and d = Dot(N0,N1)
Dot(N1,P) = a*Dot(N1,N0)+b*Dot(N1,N1)+c*Dot(N1,N0xN1)
= a*d + b*1 where N1 is unit length
Since P is on both planes Dot(N0,X) = d0 and Dot(N1,X) = d1,
Dot(N0,P) = d0 and Dot(N1,P) = d1. This gives two equations
in two unknowns a and b, d0 = a+b*d and d1 = a*d+b. Solving
for a and b gives the equation I posted.
http://www.shef.ac.uk/~eee/esg/research/tina.html
It has many functions for this kind of thing.
Mark
--
________________________________________________________________________
Mark Everingham Phone: +44 117 9545249
Room 1.15 Fax: +44 117 9545208
Merchant Venturers Building Email: ever...@cs.bris.ac.uk
University of Bristol WWW: http://www.cs.bris.ac.uk/~everingm/
Bristol BS8 1UB
I believe our two solutions are the same. I never 'solve' for parameter
c and just let it get absorbed in the N0xN1 term (i.e. (t+c)*N0xN1).
You indicated that you had one free parameter, which has to be c.
Same difference. How many ways of solving the problem? The
same as how many ways you can reparameterize a line...
Ah, interesting. I wonder how many other ways of solving this we can
think of. It's also interesting that your method and my method came
up with the same point. Another interesting thing is that the
solution we came up with is symmetric with respect to the planes. I
can see why that'd be with your method, but it's not immediately clear
to me why stepping to one plane and then to the other (like I did)
would be symmetric. I wonder what value of the free parameter in the
matrix solution our answer corresponds to...
Chris
No, the way I actually solved it had no free parameter. I was just
remarking that formulating it as a matrix constraint problem and then
doing Gaussian elimination on it would give you the explicit function
for the line.
I guess one way of thinking about the way you're solving it is to say
you're adding the 3rd plane in that's (n1Xn2).p = 0 (the plane with
normal n1Xn2 that goes through the origin). My method must be
implicitly staying on this plane even though I never use n1Xn2 in my
solution.
Maybe I find this more interesting than it actually is or something,
but I think it's kind of neat. :) A good interview question.
Chris