# Formula to extend a line in 3d (opposite of midpoint formula)

• MHB
• LMHmedchem
In summary, the conversation discusses extending a line in 3 dimensions from one point to another by using a multiplier and the formula provided by a user on stackexchange. The formula involves using a parameter 't' to generate additional points on the line and can be easily implemented in Excel. The multiplier value determines whether the new point falls between the two given points or beyond the second point. The conversation also mentions a potential follow-up question for a more complex solution.
LMHmedchem
Hello,

I have some simple 3d data like,

Code:
point 1: x1 = 5.8573375, y1 = -4.17885, z1 = 2.338175
point 2: x2 = -3.26132, y2 = 1.28276, z2 = 0.931583

I need to be able to extend the line from point 1 through point 2 to some additional distance.

There are a few posts on stackexchange, but they are all in c++ code and I couldn't get results in excel that look correct. Maybe it's just too late in the day. What I found was more or less,

Code:
x3 = x2 * M - x1, y3 = y2 * M - y1, z3 = z2 * M - z1 where M is a multiplier

For the example I gave above, this gives me a point that is no where near anything that resembles an extension of the line from point 1 to point 2.

Code:
x3 = 2.92866875, y3 = 4.82023, z3 = -1.8723835

Maybe I just got the parenthesis wrong or something lame like that. This seems like it should be very simple but I'm not sure if I need to find the slope first or if something like the above will work.

Can someone point me to the correct formula?

Thanks,

LMHmedchem

If you have a line in 3 dimensions specified by the two points:

$$\displaystyle \left(x_1,y_1,z_1\right),\,\left(x_2,y_2,z_2\right)$$

Then a vector along the line can be given by:

$$\displaystyle \vec{v}=\left[\begin{array}{c}x_1+\left(x_2-x_1\right)t \\ y_1+\left(y_2-y_1\right)t \\ z_1+\left(z_2-z_1\right)t \end{array}\right]$$

You can then use the parameter $t$ to generate additional points on the line. :)

Thanks, that worked easily.

In excel, this looks like,

for the new x coordinate (x3)
Code:
=A2+(A4-A2)*$D$2

where,
A2 is the cell containing x1
A4 is the cell containing x2
$D$2 is cell containing the multiplier

If the multiplier is < 1.0, the new point will fall between point 1 and point 2. A multiplier value of 0.5 would give you the same result as using the midpoint formula. The multiplier must be > 1.0 for point 3 to be beyond point 2. I would guess that if the multiplier is negative, point 3 would occur on the line from point 1 to point 2 but before point 1 but I haven't confirmed that.

I have a similar question but I will put that in a new thread because it is likely a more complex solution.

Thanks again,

LMHmedchem

## 1. What is the formula to extend a line in 3D?

The formula to extend a line in 3D is the opposite of the midpoint formula, which is (x1 + x2, y1 + y2, z1 + z2).

## 2. How do you use the formula to extend a line in 3D?

To use the formula, you need to know the coordinates of two points on the line and then add the coordinates together to find the extended point.

## 3. Can the formula be used for any type of line in 3D?

Yes, the formula can be used for any type of line in 3D, as long as you have the coordinates of two points on the line.

## 4. What is the difference between the midpoint formula and the formula to extend a line in 3D?

The midpoint formula finds the middle point between two given points, while the formula to extend a line finds a point that is a certain distance away from one of the points on the line.

## 5. Is the formula to extend a line in 3D commonly used in scientific research?

The formula to extend a line in 3D is commonly used in various fields of science, including physics, engineering, and computer graphics. It is useful for determining points on a line that are needed for calculations or visualizations.

• General Math
Replies
3
Views
988
• Engineering and Comp Sci Homework Help
Replies
1
Views
1K
• General Math
Replies
11
Views
6K
• General Math
Replies
4
Views
2K
• Precalculus Mathematics Homework Help
Replies
7
Views
966
• Precalculus Mathematics Homework Help
Replies
17
Views
1K
• Engineering and Comp Sci Homework Help
Replies
14
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
872
• General Math
Replies
13
Views
2K
• General Math
Replies
2
Views
2K