Click here to Skip to main content
14,424,341 members
Rate this:
Please Sign up or sign in to vote.
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 5:41am
E.F. Nijboer 3-Jun-13 10:43am
You cannot derive a single vector from just a vector and distance.
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...

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
Rate this:
Please Sign up or sign in to vote.

Solution 2

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...........

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100