Linear interpolation of three 3D points in 3D space

后端 未结 4 1989
一整个雨季
一整个雨季 2021-01-07 04:00

I have three 3D points like p1(x1,y1,z1), p2(x2,y2,z2), p3(x3,y3,z3). I have another point, but I know only x, y

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-07 04:09

    p1, p2, p3 define a plane. You can represent it by a point and a normal. For instance, P=p1, N=(p2-P) x (p3-P) (that is, N = cross product of p1p2 and p1p3).

    Now for p4 to be in the same plane, it satisfies the plane equation:

      (p4-P) · N = 0  %// dot product
    ⇒ (x4-x1)*N.x + (y4-y1)*N.y + (z4-z1)*N.z = 0
    

    Re-arranging:

    z4 = z1 - ((x4-x1)*N.x + (y4-y1)*N.y)/ N.z
    

    No linear system to solve, you just need a cross product.

提交回复
热议问题