17
$\begingroup$

Suppose I have $2$ points in a 3D coordinate space.

Say $p_1=(5,5,5)$, $p_2=(1,2,3)$. How do I find the slope of the line joining $p_1$ and $p_2$? After getting the slope (which I assume will be an integer) how do I get the coordinates of any other arbitrary point on this line?

I do understand my maths skills are not what they should be :) but i would appreciate any help, or a reference to some document/book where I can learn the basics of 3D coordinate geometry.

$\endgroup$
17
$\begingroup$

In two dimensions, we often write a line in the form $$y = mx + b.$$

However, there are other equivalent forms. Given a point $(x_0, y_0)$ on a line and the slope of the line, we can also write $$y - y_0 = m(x - x_0).$$

A disadvantage of this formula is that it cannot express lines where $x$ is constant, for example, the line $x=3$ (this problem arises because we have defined $y$ as a function of $x$). To remedy this problem, we might instead write the line in parametric form: $$\left\{\begin{array}{}y = y_0 + m_yt\\ x = x_0 + m_xt\end{array}\right.$$

We can make this formula slightly more compact by using vector notation:

$$\langle x,y\rangle = \langle x_0, y_0\rangle + t\langle m_x, m_y\rangle.$$

In this form, we call the vector $\langle m_x, m_y\rangle$ the direction vector. It turns out that the direction vector is a useful analog of slope in higher dimensions: in two dimensions, the ratio between the change in $x$ and $y$ is $\Delta x:\Delta y = m_x : m_y$, and this is true even if $\Delta x = 0, \Delta y \not= 0$.

In three dimensions, we have

$$\langle x,y,z\rangle = \langle x_0, y_0, z_0\rangle +t\langle m_x, m_y, m_z\rangle.$$

For your particular example, we can pick $\langle x_0, y_0, z_0\rangle = \langle 5,5,5\rangle$, $\langle m_x, m_y, m_z\rangle = \langle 1,2,3\rangle - \langle5,5,5\rangle= \langle-4,-3,-2\rangle$, so the line can be expressed as

$$\langle x,y,z\rangle = \langle 5,5,5\rangle +t\langle -4,-3,-2\rangle,$$

and the line has the direction vector $\langle -4, -3, -2 \rangle$. Observe that by varying the value of $t$, we can get other points on the line: $t=0$ corresponds to $p_1$, $t=1$ corresponds to $p_2$, and other $t$ values will correspond to other points.

You can find more information about writing lines in three dimensions as vector functions here.

$\endgroup$
7
$\begingroup$

When moving on from two- to three-dimensional geometry, we need three different slopes to characterize the line passing through two points. These can be pictured as the slopes of the "shadows" or projections of the line onto each of the three coordinate planes.

The segment connecting $ \ p_1 \ $ to $ \ p_2 \ $ has a length $ \ \sqrt{(1-5)^2 \ + \ (2-5)^2 \ + \ (3-5)^2 } \ = \ \sqrt{29} \ $ . The "slopes" , called direction cosines, on the $ \ xy- \ , \ xz- \ $ and $ \ yz-$ planes are then

$$ \frac{3-5}{\sqrt{29}} \ = \ \frac{-2}{\sqrt{29}} \ \ , \ \ \frac{2-5}{\sqrt{29}} \ = \ \frac{-3}{\sqrt{29}} \ \ , \ \ \frac{1-5}{\sqrt{29}} \ = \ \frac{-4}{\sqrt{29}} \ \ , $$

respectively. If it doesn't matter whether you are going from $ \ p_1 \ $ to $ \ p_2 \ $ or vice versa, you can just take the absolute values of these numbers. (Notice that the sum of the squares of these values equals 1 . )

There are other ways in which the behavior of the line in three-dimensional space is described as well. You can find discussions of the topic of lines and planes in three dimensions as a section in books on analytic geometry or multivariable calculus (this hasn't much to do with calculus as such, but that's often where this is treated in the curriculum), or online sources.

$\endgroup$
  • 1
    $\begingroup$ well, now I understand why those maths classes were important, I remember seeing that formula to calculate slopes. But never really understood the real use of it until i started working on grahics :) Thanks, that helps $\endgroup$ – 2am May 19 '14 at 1:35
  • $\begingroup$ This is also treated in linear algebra. $\endgroup$ – Leponzo Apr 14 '16 at 16:57
  • $\begingroup$ Don't you have to take arccos of these? $\endgroup$ – Alaa M. May 11 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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