NCHUMPENI SHITIRI
NCHUMPENI SHITIRI

Reputation: 1

Find a point coordinate between two points

Let's say I have two points P1(x1,y1,z1), and P2(x2,y2,z2). I want to find P3(x3,y3,z3) between these two points. How can I find P3? P3 can be anywhere between P1 and P2, hence I cannot use the mid-point formula. Figure shown below

Upvotes: 0

Views: 160

Answers (1)

SomeNorwegianGuy
SomeNorwegianGuy

Reputation: 1534

You can use the idea of a weighted average of the two points.

P3 = p * P1 + (1 - p) * P2

or written out
x3 = p * x1 + (1 - p) * x2
y3 = p * y1 + (1 - p) * y2
z3 = p * z1 + (1 - p) * z2

where p is some number between 0 and 1.

So a p of 2/3, would give you a point 2/3 the way starting from P1 toward P2.

Upvotes: 1

Related Questions