操纵两个向量之间的距离

4
我在操作两个点之间的距离时遇到了困难。
已知A和B的x、y、z坐标以及它们之间的距离,如何在保持两点之间角度不变的情况下增加或减小它们之间的距离?
假设点A位于0, 0, 0,点B位于3, 3, 0。
我能够计算出两点之间的距离为4.242。
我需要能够沿着同一切线“推”点B进一步X。有什么建议吗?
提前致谢。

1
你不能将B的每个坐标乘以相同的标量吗? - smk
我同意@SajitKunnumkal的观点,如果你将向量乘以标量,它的方向应该被保留。 - gustavodidomenico
@SajitKunnumkal 只有当点A是原点时才有效。否则,对B进行标量乘法将改变A和B之间的角度。 - Celada
你是正确的...让我想一想。 - smk
1个回答

6
  • Subtract A from B to get the vector D representing the distance and direction from A to B

    D = B - A
    
  • Multiply D by your scalar x to push it further from A along the same direction: (I'm changing your X to x to emphasize that it is a scalar).

    D' = xD
    
  • Get the new point B' that is in the same direction from A as B is, but is further away (assuming x > 1):

    B' = A + D'
    

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接