C++

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

—SA