Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Say I have 2 separate objects.

One is a line defined by two points, the other is a polyline defined by three points.

Line 1 consists of the set of two points:

$a=(0,0,0)$ and b=$(0,0,1)$

Line 2 consists of the set of three points, which in this example are:

$c=(4,1,1)$, $d=(3,3,2)$, $e=(4,4,3)$

So line 2 has two end points and one "inner" point. This "inner" point can also be two or more, till $n-2$ for arbitrary polylines.

The problem is a way to transform line 2 so that it fits in line 1. In other words, scale and rotate all three points of line 2 so that it aligns with line 1.

Point $c$ would map to point $a$ and point $e$ would map to point $b$. Point $d$ also has to be calculated and added to the point set of line 1. I have linked a figure to illustrate the two objects. The positive Z-axis is pointing up.


As shown in the linked figure, line 1 is just a unit vector in the Z-direction. This line can also start from another position such as $a_2= (1,1,1)$ till point $b_2=(1,1,2)$ if starting at $(0,0,0)$ is a problem and as long as it is of unit length in the Z-direction. Then, in the end it is just a matter of translating all the transformed points of line 2 with the vector $(b_2 - a_2)$ to get back to the starting position of $(0,0,0)$.

So, in this example the end the result would consist of a set of three transformed points, shown in the matrix below: $$\begin{bmatrix} 0&0&0 \\\\ ...&...&... \\\\ 0&0&1 \end{bmatrix}$$

To summarize, the problem is how to transform line 2 into line 1 and also how to compute the "inner" points.

share|improve this question
add comment

2 Answers

Check out Umeyama's method in the following presentation (page 8): http://campar.in.tum.de/twiki/pub/Chair/TeachingSs09CAMP2Lecture/06PointBasedRegAndOptimization.pdf

The problem can be solved using algorithms solving the general transformation estimation problem between 3D point sets with known correspondences (assuming a linear transformation between the points).

You would basically solve the transformation estimation from point correspondences between the endpoints of the polylines if you approach it the way you described.


share|improve this answer
add comment

Let $T_1$ be the transformation that translates by the vector $a-c$.

Let $\theta$ be the angle between the vectors $b-a$ and $e-c$, and let $N$ be the normal of the plane containing these two vectors. Let $T_2$ be the transformation that rotates by an angle $\theta$ around $N$.

Let $s$ be the length of $e-c$ divided by the length of $b-a$. Let $T_3$ be the transformation that scales by $s$.

Then the transformation you want is $T_1*T_2*T_3$. Apply this transformation to all the points of the polyline.

share|improve this answer
Do the points given by vectors $\left[b-a\right]^T$ and $\left[e-c\right]^T$ have to be coplanar for this to work? I am wondering now if incoplanarity would affect $N=\left[b-a\right]^T\times{\left[e-c\right]^T}$. Didn't try it out yet, just wondering... –  sPLUS Feb 18 at 16:33
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.