0
$\begingroup$

I have three parallel lines (3d lines). say AB, CD, EF. The center line i.e. CD is given by intersecting the two planes by which the AB, DE lie on. The shortest distance between AB and CD (say d1) is not exactly equal to the CD and EF (say d2).

the line which is given a shorter distance from the center line should be replaced by a fourth line, making equal distance separation with the other line.

I know vectors of each line, and also know a 3D point lie on each line as well.

I was trying to do it. But cannot figure out exactly and got some wrong answers. sometime fourth line make the separation more shorter (may be the vector is directing other way). I should say that vectors of AB,CD & EF lines are not directing in to same direction.

So, I am looking for a concrete way to do this. I have vector3 class.

please anyone show me how to do this. thanks

  • 0
    Also posted as http://stackoverflow.com/q/13612752/14683662012-11-29

1 Answers 1

0

I know vectors of each line, and also know a 3D point lie on each line as well.

So I assume you have the points $A$, $C$ and $E$ as well as the vectors $(B-A)$, $(D-C)$ and $(F-E)$ (which all point into the same direction). Furthermore I assume that there is no special relation between your points, and that in particular you have no guarantee that the points $ABC$ span a plane which is perpendicular to all of your parallel lines.

First I'd obtain two vectors which point from $CD$ into the direction of the other two lines. You can obtain them like this:

\begin{align*} v &= (A-C) - \frac{(A-C)\cdot (D-C)}{(D-C)\cdot (D-C)}(D-C) \\ w &= (E-C) - \frac{(E-C)\cdot (D-C)}{(D-C)\cdot (D-C)}(D-C) \end{align*}

What this does is take the difference vector $(A-C)$ reso. $(E-C)$ and subtract from that the component in the direction of line $CD$. The result will be a vector pointing from $CD$ to $AB$ resp. $EF$ which is orthogonal to $CD$.

Now you can use $\lVert v\rVert$ and $\lVert w\rVert$ to compare distances. Let us for the moment assume that $\lVert v\rVert < \lVert w\rVert$. In that case, you want to compute $A' = C + \frac{\lVert w\rVert}{\lVert v\rVert}v$ and $B'=A'+(B-A)$. Otherwise you compute $E'$ and $F'$ in a similar way.

  • 0
    let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/6563/discussion-between-mvg-and-user1199463)2012-11-30