I am having a hard time manipulating the distance between two points.
Given x y z coordinates for A and B, and knowing their distance, how can I increase or decrease this distance keeping the angle between the 2 points?
Say point A is at 0, 0, 0 and point B is at 3, 3, 0.
I am able to calculate the distance between the two points to be 4.242.
I need to be able to "push" point B further on the same tangent by X. Any ideas?
Thanks in advance.
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With