Generating a 3D vector at a relative angle to another given 3D vector

Hello *,
Is it possible to generate a 3D vector at a relative angle to a given 3D vector.
Lets say i have a 3D vector “P” and i want to generate another 3D vector "Q"
at a relative angle of 170 degree from “P”.


Maybe @agheata has more precise information, but in the meanwhile, you could check the TVector3 Class Reference


note that you defined an infinite set of vectors around the axis defined by the original vector. The problem you are trying to solve is not well defined.
My two cents.


Thanks everybody for the replies,
I agree that we have infinite set of vectors around axis defined by original vector.

Currently i am managing with following work around.
Generate random theta and phi and then using spherical coordinate system, generate the
3D vector, now if the angle between initial vector and this is the one that we want then
break, otherwise continue the loop until the angle between the initial and randomly generated
vector is the desired one.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.