# comp.graphics.algorithms

## Subject: Re: common point of two planes

> hi,
> I need to compute a common point of two planes which are given by
> general equations a1x + b1y + c1z + d1 = 0 and a2x + b2y + c2z + d2 =
> 0. Is there some easy way how to compute it without converting into
> parametric form and solving some system of equations ?

You should have no reason to avoid any kind of a solving technique. If
the problem is unambiguous, the solution is objective: no matter how you
reach it, it will always be the same. I like to see mathematical
machinery as tools: because the solution is objective, I can choose any
tool I wish. Naturally I prefer those tools that induce the least work
for me.

That said, lets use the parametric form and see what we end up with.

Parametrize plane A with (u, v):

A(u, v) := Pa + u * Ua + v * Va

where
* Pa is a point on plane A
* Ua and Va are non-parallel (positive length) tangent vectors in the
plane A

All points A(u, v) lie on plane A. We wish to search for a set of A(u,
v) points that also lie on plane B. We make the old trick of specifying
this other plane as an implicit equation:

dot(A(u, v) - Pb, Nb) = 0

where
* Pb is a point on plane B
* Nb is the normal of the plane B

Implicit equations and parametric equations mix nicely, as we can see by
substituting the first equation to the second:

dot(Pa + u * Ua + v * Va - Pb, Nb) = 0

By bilinearity of dot product we can separate the u and v out:

dot(Pa - Pb, Nb) + u * dot(Ua, Nb) + v * dot(Va, Nb) = 0

Solving for u yields:

u = (dot(Pb - Pa, Nb) - v * dot(Va, Nb)) / dot(Ua, Nb)

Here we assumed dot(Ua, Nb) != 0. Geometrically this means that planes A
and B are parallel, in which case there is no intersection or the planes
are the same.

Because the intersection is a line, v can be selected arbitrarily: an
easy selection is v = 0, or you might try a different selection
criteria. One that pops into mind is minimizing the distance of the
solved point to some other point (for example, origin).

After choosing v, substitute u back into the first equation and you have
got rid of the (u, v) parameters and thus the parameteric form! Like
said, the solution is objective, independent of the solving technique.

--
Kalle Rutanen
http://kaba.hilvi.org