How to obtain 3D coordinates of the point by the length of the vector?

41 Views Asked by At

How can I obtain R3 position of a point?

For example, I've got two points linked by a vector:
p1 = (-4000;250;-5000)
p2 = (428;776;-300)
|v| = 6926.32

I'd like to find a point which lies on the line at a given distance from the first point
nl - given length
ny - new y
y - y from p2
l = |v|
and:

y     l
-  =  -
ny    nl

so:
nl * y = l * ny
ny = (nl * y) / l

Same with x and z:
nx = (nl * x) / l
nz = (nl * z) / l

nl = 0:
nx = (0 * 428) / 6926.32 = 0
ny = (0 * 776) / 6926.32 = 0
nz = (0 * -300) / 6926.32 = 0

(Shouldn't it be p1?)
And my question: how can I correctly obtain new points?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $v = p_2 - p_1 = \big((428 - 4000), (776-250), (-300 -(-5000))\big)$. Let $\hat v = \frac{v}{|v|}$.

Then the point $r(t)$ on the line at a distance $t$ from $p_1$ is given by $$r(t) = p_1 + t\hat v$$ (where positive $t$ gives the point at that distance in the same direction as $p_2$, while negative $t$ gives the point at distance $|t|$ in the opposite direction).