[Math] Equation to a Perpendicular Line Along A Plane

3dgeometry

I have the following problem, which Google has not yet been able to answer.

I have the equations to two lines in 3D space. I also have the co-ordinates of a single point on each line. I can therefore find the co-ordinates of a third point on either line and compute the equation to a plane that contains both lines.

Now what I need to do is to compute the equation to the normal lines to each of these lines so that both normal lines are also on this plane. After this, I need to find the point of intersection of these two lines.

I'd appreciate any help on this topic.

Thank you.

PS: This is my first post on MSE, so if I'm violating any MSE rules, please point them out so that I can correct my post and not make such a mistake in the future

EDIT More information as requested in the comments:

I'm not trying to solve a specific question. I'm trying to write a program that is flexible enough to do this.

So as parameters to this program, I have values for A, B, C – the coefficients for the equations to the lines written as Ax + By + C = z.

I know that for every pair of lines, there is a plane on which these two lines reside. I will therefore need to compute the equation to this plane.

The idea is that there is an object moving along a path (some curve) on a plane (some plane whose equation I must compute), that I detect with a sensor. I am allowed to assume a monotonous curve between any two consecutive detections. I need to figure out the coordinates of the center of the circle on whose circumference this monotonous curve exists.

Please let me know if that clarifies the question

Best Answer

I will give a solution whose starting point is as follows: I know two points $P_1$ and $P_2$ on line 1 and points $Q_1$ and $Q_2$ on line 2.

Form the vectors ${\bf p} = P_2-P_1$ and ${\bf q}=Q_2-Q_1$.

Check for an intersection of the two lines: ${\bf p}t+P_1={\bf q}s+Q_1$ for some pair of real numbers $s$ and $t$. If no solution is found, the lines do not intersect.

Next, check to see if ${\bf p}$ is a scalar multiple of ${\bf q}$ (i.e. ${\bf p}=s{\bf q}$ for some $s$). If this is true, the directions of the lines are parallel.

There are 4 cases:

1) Intersecting + Parallel Directions = They are the same line (FAIL: One line will not determine a plane.)

2) Not Intersecting + Non-parallel Directions = They are skew lines (FAIL: Skew lines do not lie in a common plane.)

3) Not Intersecting + Parallel Directions = Parallel lines. In this case any normal line for one line will be normal for the other. So any point in the plane will lie on a common normal line. If you would like a point "between" the two parallel lines: Form a vector ${\bf r}=Q_1-P_1$ (this points from $P_1$ on line 1 to $Q_1$ on line 2). Project this vector ${\bf r}$ onto ${\bf p}$ (the direction of the first line): ${\bf w}=\mathrm{proj}_{\bf p}({\bf r}) = \frac{{\bf p\cdot r}}{|{\bf p}|^2}{\bf p}$. Then ${\bf r}-{\bf w}$ is a vector which lies in the plane and is orthogonal to the first line and points from the first line to the second. So $P_1+(1/2)({\bf r}-{\bf w})$ is a point exactly half-way between the two lines.

4) Intersecting + Non-parallel Directions = Distinct intersecting lines. In this case compute the cross product ${\bf n}={\bf p} \times {\bf q}$ to get a vector normal to the plane. Then ${\bf v} = {\bf n} \times {\bf p}$ will lie on the plane and be perpendicular to line 1. Likewise ${\bf w}= {\bf n} \times {\bf q}$ for line 2. Then the lines parametrized by ${\bf v}t+P_1$ and ${\bf w}s+Q_1$ will be normal to lines 1 and 2 respectively. Solving ${\bf v}t+P_1={\bf w}s+Q_1$ will give you the point of intersection of these normals.

Edit: Oops! I forgot to mention. If the lines intersect and you create normal lines at that point of intersection, then those normal lines intersect at that point of intersection!