Finding coordinates of a point between two points?

后端 未结 4 481
半阙折子戏
半阙折子戏 2020-12-03 18:09

Doing some 3D stuff in wpf- want to use a simpler test to see if everything is working (before moving to curves).

The basic question is given two points x1,y1,z1 and

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 19:11

    This has to do with math, but ok. Let P and Q be the two given points and X the point you're looking for.

    P + r(Q - P) = X
    

    r indicates a factor.

    if 0 < r < 1: the point x will be on the line between the two points.

    That's it!

    EDIT:

    To find a point at a given distance d from P(p1/p2/p3):

    d² / euclidian_square_distance(P,Q) = r
    

    Insert r in the equation mentioned above and you'll have your point! :)

    P.S: Btw: P-Q = (Px - Qx, Py - Qy, Pz - Qz)... i bet you alread knew it :)

提交回复
热议问题