# Straight line in 3D space (equation for ~)

• February 6th 2008, 06:57 PM
Dirlewanger
Straight line in 3D space (equation for ~)
I know two points in 3D space:
{x1, y1, z1} and {x2, y2, z2}

How do I find the coordinates of a third point at y=y3 on a straight line through those two points?

(Emo)
• February 6th 2008, 10:20 PM
earboth
Quote:

Originally Posted by Dirlewanger
I know two points in 3D space:
{x1, y1, z1} and {x2, y2, z2}

How do I find the coordinates of a third point at y=y3 on a straight line through those two points?

(Emo)

The equation of the line is:

$(x,y,z) = (x_1, y_1, z_1)+r \cdot \left((x_2, y_2, z_2) - (x_1, y_1, z_1)\right)$

If you know the value of $y_3$ then you can determine the value of r by solving the equation:

$y_3 = y_1 + r \cdot (y_2 - y_1)$

Once you know the value of r you can plug it into the equation of the line to calculate the missing coordinates of the point.