0

I want to understand the formula for using a slope and distance from a point either a positive or negative direction: to: determine the X coordinate of a point on that line which is "D" distance away from your original point in the direction which you specified.

I found this link: " https://www.freemathhelp.com/forum/threads/70424-Find-coordinates-given-original-point-and-slope " which has an equation which supposedly does what I want; but could someone please explain the formula I need, to me in plain enlgish, and also in the standard formula form (like the kind most people use), and also in psuedo-code?

So that I may tripple-check my comprehension?

I can get anxiety and then second-guess myself on these matters; so I get next-to-nothing done sometimes...

bonus point if you can explain to me a procedure for writing the program in N-dimensional coordinate space; but if you would rather not: I only desperately need 2-dimensional (x,y) coordinate space right now...

3 Answers3

2

Consider the equation of your line $y=m(x-a)+b$ and the equation of a circle with radius $D$ from your original point, $D^2=(x-a)^2+(y-b)^2$. Here I am assuming the coordniates of your original point is $(a,b)$. Because the point of intersection between the circle and line have to have the same x and y coordinate you can then substitute the $y$ from your line into the circle to give you $D^2=(x-a)^2+(m(x-a))^2$. From there you can solve for $x$. If you need more guidance from there I can give you some more hints.

  • Where does the op mention any circles, or intersection of thereof? – John Alexiou Feb 01 '18 at 21:50
  • The op mentions distances. A circle is all points equidistance for a center. So the points on the line that are that distance away, will be points on the circle. So the points will be the points of intersection of the line and the circle. The OP didn't mention circles. But this answer did. Because they solve the problem. – fleablood Feb 01 '18 at 21:57
  • Why is "D" squared? Your answer seems like the simplest/easiest/best; but I'm missing something, and hence fail to grasp it, please explain (sorry for my lack of competence) – user179283 Feb 02 '18 at 01:22
  • Its fine! $D^2$ represents the square of the distance from your original point. There is nothing to be worry about, I'm here to try and answer your questions. – Aaron Quitta Feb 02 '18 at 01:42
  • Actually, like this one better than mine. It's a simple formula. I reinvented the wheel and hammered through. – fleablood Feb 02 '18 at 01:48
  • So I merely square the distance from the new starting point; calculate the slope of my new line which crosses that point; set it to equal this distance; solve for the 2 zeroes, and then pick the one tending towards my prefered direction based off of which on is closer to the origin and whether or not the two zeroes are positive/negative? – user179283 Feb 02 '18 at 22:42
  • I've been feeling a bit cognitively deficient as of late; but am working on a passion project which requires me not to be, so cosing a bit of an internal conflict, and I may need to have it handed to me in very basic verbatim; I apologize if that is inconvienient please work with me. Once I understand: I will select your answer, I feel embarrassed, but I've been kindof behind as of late – user179283 Feb 02 '18 at 22:45
  • Sounds just about right! – Aaron Quitta Feb 02 '18 at 22:46
  • Your fine, I'm completely open with helping you. – Aaron Quitta Feb 02 '18 at 22:47
  • Alright, so can we work through an example problem? because my rudimentary understanding of calculus implies that there are an infinite number of points along the circumference of a circle, so I'm a bit confused about how we are to narrow out our two points from infinity... is it just written as an algebraic equation? Ie: "point along a line of this slope is also, this distance"? May I see an example, most math-veterans could probably [just] imagine one [at the tip of a hat], but I get overwhelmed [and would not yet consider myself to have earned math-veteran status] – user179283 Feb 02 '18 at 23:12
  • So, if I wanted to travel 7m across a slope, in a given direction, from a given point [1,2 (for brevity)]: I would say: "14 = (X-1)^2+(Y-2)^2" and then solve for "X" and then input X into my slope from the beginning in-order-to: find Y, and then those two would give me the coordinates of new point that be 7m from the "1,2" point along the slope? – user179283 Feb 02 '18 at 23:22
  • I'm nervous that I'm missing something – user179283 Feb 02 '18 at 23:22
  • Yep, you got most of it! I actually miased a little bit of information in my answer, which I'll append, but overall its the same. So if you are traveling 7 meters along a slope or a line with a slope of lets say 3, then you would have $49= (x-1)^2+(y-2)^2$. Now the line that goes through the point $(1,2)$ with slope 3 would be $y=3(x-1)+2$, this is the part that I initionally forgot to mention in my answer. Then you would do the substitution of $y$, giving you $49= (x-1)^2+(3(x-1)+2-2)^2$, then you can solve for $x$, and once you know $x$ you can find the $y$ coordinate of the point as well. – Aaron Quitta Feb 03 '18 at 00:29
  • OK, I will checkmark your answer as it is the most efficient, I am facepalming that I did 7×2 as opposed to 7×7, I think I just subconciously skip a beat with powers – user179283 Feb 03 '18 at 00:49
2

You have a point with coordinates $(w,z)$.

Part I:

Suppose there were another point on the plane. Any point on the plane. We aren't worry about how to get the point you want; just any point with coordinate $(a,b)$.

So what is the distance between $(w,z)$ and $(a,b)$? Well, in the horizontal direction $w$ and $a$ are $|w - a|$ apart. In the vertical direction $b$ and $z$ are $|z-b|$ apart. The vertical and the horizontal distances form two legs of a right triangle. The hypotenuse of that triangle will be the distance between the points.

The pythagorian theorems says this hypotenuse squared is the sum of the squares of the legs. So $distance^2 = |w-a|^2 + |z-b|^2$ and so $distance = \sqrt {(w-a)^2 + (z-b)^2}$.

This is the famous distance formula. $d((x_0,y_0) =$ distance between point $(x_0, y_0)$ and $(x_1,y_1)$ $= \sqrt {(x_1-x_0)^2 + (y_1-y_0)^2}$.

Put a pin in that.

...

Part II

You have a slope that is $m$. That means if you move $k$ units in the horizontal direction you will move $km$ units in the vertical direction. This work forward and backwards. If you move $-k$ units in the horizontal direction you will move $-km$ units in the vertical direct.

So if you move $k$ units forward from point $(w,z)$ your $x$- coordinate will be $w + k$, and your $y$- coordinate will be $y +km$ or the point $(w + k, z + km)$.

We can use this do find an equation for the line. A point of the line will be any point $(x,y)$ where $x = w +k$ and $y = z + km$. Manipulating this algebraically we get $k = x-w$ so $y=z +(x-w)m = mx + (z-wm)$. (Note: $z-wm = b$ equals the $y$ intercept because we had to go $w$ units back to get to $x=0$ and that means vertically we needed to go back $mw$ units.)

.....

Part III

So we have a point $(w,z)$ and the line. We want to move it forward (or back) $k$ units to get the point $(w + k, z + km)$ and we want $d((w,z), (w+k,z+km)) = $ to a specific distance $D$.

So we want $d((w+k, z+km)) = \sqrt{[(w+k)-w]^2 + [(z+km) - z)]^2} = D$.

Well.... let's do it. Let's solve for $k$ (which is how for we must move forward horizontally).

$\sqrt{[(w+k)-w]^2 + [(z+km) - z)]^2} = D$

$\sqrt {k^2 + (km)^2 } = D$

$k^2 + k^2m^2 = D^2$

$k^2(1 + m^2) = D^2$

$k^2= \frac {D^2}{1+m^2}$

$k = \frac {D}{\sqrt{1+m^2}}$.

So the point we want is that we go $\frac {D}{\sqrt{1+m^2}}$ horizontally, and $m*\frac {D}{\sqrt{1+m^2}}$ vertically.

So the point is $(w + \frac {D}{\sqrt{1+m^2}}, z + m\frac {D}{\sqrt{1+m^2}})$.

To go in the opposite direct you get $(w - \frac {D}{\sqrt{1+m^2}}, z - m\frac {D}{\sqrt{1+m^2}})$

So $(w \pm \frac {D}{\sqrt{1+m^2}}, z \pm m\frac {D}{\sqrt{1+m^2}})$

....

Example:

Suppose you have a point $(8, 9)$ and we have a slope of $\frac 34$ and we want to find the two points that are $5$ units away.

Our formula is $(x \pm \frac {D}{\sqrt{1+m^2}}, y \pm m\frac {D}{\sqrt{1+m^2}})$

So $(8\pm \frac 5{\sqrt{1+ \frac 9{16}}}, 9\pm \frac 34\frac 5{1 + \frac 9{16}}) = $

$(8\pm \frac 5{\sqrt{\frac {25}{16}}}, 9\pm \frac 34\frac 5{\sqrt{\frac {25}{16}}})=$

$(8 \pm \frac 5{\frac 54}, 9\pm \frac 34*\frac 5{\frac 54})=$

$(8\pm 4, 9\pm 3)$

so the points are $(4, 6)$ and $(12, 12)$. So $(

fleablood
  • 124,253
  • This answer was very helpful, and seems to be exactly what I wanted; I'm feeling a bit mentally fatigued today, so I only skimmed it, but I get the feeling that: once I sit down and play with it a bit; I'll understand better, seems very complete and good – user179283 Feb 02 '18 at 01:13
0

So so you have a point

$$ \mathbf{p} = \pmatrix{a\\b} $$

and a direction, given a slope $m$, the direction angle $\theta$, or another point $\mathbf{q} = \pmatrix{c \\ d}$.

The direction vector is

$$ \mathbf{e} = \pmatrix{e_x \\e_y} = \pmatrix{1 \\ m} = \pmatrix{ \cos\theta \\ \sin\theta} = \pmatrix{c-a \\ d-b} $$

This just describes how much you move up or down $e_y$ for every move to the right $e_x$.

Now you have an equation for any point along the line with a distance $t$ from $\mathbf{p}$

$$ \mathbf{r} = \mathbf{p} + t \, \frac{\mathbf{e}}{\| \mathbf{e} \|} $$

$$ \pmatrix{x\\y} = \pmatrix{a\\b} + \frac{t}{\sqrt{e_x^2+e_y^2}} \pmatrix{e_x\\e_y} $$

where $\| \mathbf{e} \| = \| \pmatrix{e_x & e_y} \| = \sqrt{e_x^2+e_y^2}$ is the length of the direction vector.

The explanation is that the length of the direction vector $\| \mathbf{e} \|$ represents physical distance the vector spans. Since you want this distance to be 1 when $t=1$ the vector is scaled to form a unit vector (vector with length equal one)

$$\mbox{(unit vector)} = \frac{1}{\| \mathbf{e} \|} \mathbf{e} = \frac{1}{\sqrt{e_x^2+e_y^2}} \pmatrix{e_x\\e_y} = \pmatrix{\frac{e_x}{\sqrt{e_x^2+e_y^2}}\\\frac{e_y}{\sqrt{e_x^2+e_y^2}}}$$


In arbitrary dimensions, the equation is still

$$ \mathbf{r} = \mathbf{p} + t \, \frac{\mathbf{e}}{\| \mathbf{e} \|} $$

with an appropriate calculation of the length $\| \mathbf{e} \| = \sqrt{ e_x^2+e_y^2+e_z^2+ \ldots} $.

John Alexiou
  • 13,816
  • Interesting... your answer is very satisfying as well, but for personal reasons I try to shy away from irrational trig functions (with the exception of square root) because I am trying to create a version of angles which does without them; as a matter of personal pride. Literally anyone else in the world would pick your answer though; and I do find it to be very comprehensive. If I could checkmark more than one answer: yours would be one of my chosen answers; thank you – user179283 Feb 02 '18 at 01:20