# Finding points along a line in 3D

• Nov 15th 2012, 05:18 AM
kedwards
Finding points along a line in 3D
I know the coordinates of 2 points (x1,y1,z1) and (x2,y2,z2) which define a line in 3D space. I would like to find the location of a third point (x3,y3,z3) along this line which is a known distance R13 from point 1 and distance R23 from point 2.
I am a little stumped on how to get started. I think I have to use the parametric form for the line, x=x1+(x2-x1)t, y=y1+(y2-y1)t, z=(z2-z1)t, and the fact that R23^2=(x2-x3)^2 + (y2-y3)^2 + (z2-z3)^2, R13^2=(x1-x3)^2 + (y1-y3)^2 + (z1-z3)^2. But I am not sure how to set up the equations and solve them to get (x3,y3,z3) since I haven't worked with the parametric form before. Any help is appreciated.
• Nov 15th 2012, 05:45 PM
chiro
Re: Finding points along a line in 3D
Hey kedwards.

If all points are on the same line then you wish to solve a simultaneous set of equations to find the value of t.

So the first thing to do is get your parametric form in terms of r = r0 + n*t where n is a normal direction vector (if its not normalized, then normalize it). We normalize this because it aids distance calculations.

If you know the point and the distance from that point along the line then if the distance is d the new point will be z = z0 + d*n with normal n corresponding to the one above and z0 is the point that you know.

So you use the other point information where z = y0 - e*n where y0 is the other point on the line and e is the distance. We use a plus and a minus because of the two directions.

Now you have a simultaneous equation which you can solve for z given this information to get a solution.

When you get a value for d or e plug in and you have a solution.
• Nov 16th 2012, 07:22 AM
kedwards
Re: Finding points along a line in 3D
Thanks so much. Here is a nice explanation of the parametric form of the line eqn in case someone finds it useful: Chapter 3 of this book. I swear I never had this in school, but then again it's been a while!