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.

I need to find a point along a line segment in three-dimensional space, given two points.

For example: Find a point along a line segment between point $a(-2, -2, -2)$ and $b(3, 3, 3)$ which is at distance $3$ from point $a$, in the direction of point $b$.

I've been trying to figure out a way to do it with three parametric equations, or with similar triangles, but I can't seem to make sense of it.

Any help is greatly appreciated.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The parametric equations joining $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ are

$$\begin{align*}x&=(1-u)x_1+ux_2\\y&=(1-u)y_1+uy_2\\z&=(1-u)z_1+uz_2\end{align*}$$

where taking $u=1$ gives the point $(x_2,y_2,z_2)$. The distance from $(x_1,y_1,z_1)$ to a point given by the parametric equation above is $d|u|$, where $d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$. One now needs to solve $3=du$ and substitute the value of $u$ obtained in the parametric equations to obtain the desired point.

share|improve this answer
    
Thats quite simple, thank you for humoring my question despite its simplicity. My sincere thanks =) –  Charles Nov 18 '11 at 16:15
    
I think this is wrong. I am not very sure what the right answer is though. Too see that, consider just the two dimensional case with $(0,0)$ and $(1,1)$ and a distance of $1$. Then the solution should be $(\sqrt{2},\sqrt{2})$ not $(1,1)$ –  picakhu Nov 18 '11 at 16:20
    
The distance between $(x,y,z)$ and the first given point is $u$ times the distance between the two given points. –  r.e.s. Nov 18 '11 at 16:28
    
@r.e.s. Hmm, right. Let me fix... –  J. M. Nov 18 '11 at 16:38
    
@picakhu: check now. –  J. M. Nov 18 '11 at 16:42
show 1 more comment

An alternative method even though the question has been answered:

Begin by creating a vector $\mathbf{\overrightarrow{\text{BA}}}$ by subtracting $\mathbf{A}$ from $\mathbf{B}$: $\langle 3, 3, 3 \rangle - \langle -2, -2, -2 \rangle = \langle 5, 5, 5 \rangle$. Then, normalize this vector by dividing $\mathbf{\overrightarrow{\text{BA}}}$ by its length, $ \frac{\mathbf{\overrightarrow{\text{BA}}}}{\lVert \mathbf{\overrightarrow{\text{BA}}} \rVert} = \frac{\langle 5, 5, 5 \rangle}{\sqrt{5^2+5^2+5^2}} = \langle 0.577, 0.577, 0.577 \rangle$. This new unit vector can then be scaled and added to $\mathbf{A}$ to find the point in space at the desired distance. In this case: $\mathbf{A} + 3\langle 0.577, 0.577, 0.577 \rangle = \langle -0.268, -0.268, -0.268 \rangle$.

Hope this is useful/correct!

share|improve this answer
    
Thanks for the additional info. I'll definitely be evaluating this vector-based approach as well. –  Charles Nov 18 '11 at 16:52
add comment

Your Answer

 
discard

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.