Click here to Skip to main content
15,741,692 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
Hi friends........

we can find disance for two 3D vectors from this formula.
Vector3f u = new Vector3f(X,Y,Z);
Vector3f v = new Vector3f(X,Y,Z);

decimal  a = (u.X - v.X)
decimal  b = (u.Y - v.Y)
decimal  c = (u.Z - v.Z)

decimal distance= Math.Squareroot(a * a + b * b + c * c);

i have one 3D vector and distance.
i need the other 3D vector....
Please reply me the derived formula to calculate the other 3D vector.
Thank You Friends..........
Updated 3-Jun-13 4:41am
E.F. Nijboer 3-Jun-13 10:43am    
You cannot derive a single vector from just a vector and distance.
Sergey Alexandrovich Kryukov 3-Jun-13 11:05am    
Right, the question makes no sense at all. The shown formula is correct, but the question demonstrates the lack of understanding what a vector is.

This is elementary (well, almost) mathematics, some field of mathematics which is prerequisite to programming of such problems. But this is the software forum. So, the question is, formally, off-topic. The inquirer needs to master the prerequisite topics first, then ask questions...


The coordinates of the 'other vector' are

x(theta, phi) = X0 + D * sin(theta) * cos(phi)
y(theta, phi) = Y0 + D * sin(theta) * sin(phi)
z(theta, phi) = Z0 + D * cos(theta)

where D is the dinstance, theta and phi have arbitrary values.
That means you have not a single vector at distance D but infinite (squared!) ones. If you like you may assign values to theta and phi to pick one of them.
Share this answer
yea, sorry for my misunderstand in vectors..
I found the answer by deriving a single vector, distance and magnitude of the second vector to find Second Vector........

Thanks for your valuable replys...........
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900