am struggling for hours with turning something that already works perfectly in 2D, into 3D space. Really hope someone can help…
The task is to determine the absolute rotation of a point around the coordinate system so that rotation can then be applied to another point. In 2D you do that with simple atan2(X, Y) that gives the angle which then can be applied to a point by rotating it around the origin (0,0).
But how would I do exactly the same in 3D space?
I know the procedure to compute the angle between two vectors (v1, v2): arccos( dot(v1, v2) / (magnitude(v1)*magnitude(v2)) )
However since I have only the input vector, I cannot use this. I would need an "origin vector" like [0,0] in 2D. Unfortunately the procedure fails when a vector is [0, 0, 0] (not surprising as it results in computing arccos of 0 / 0).
Does someone have an idea?
As additional information: I do know the normal vector of a plane where the point is found in but again I have the same problem that this normal vector does not contain an orientation,
Huge thanks in advance!
In 3D a rotation cannot be parameterized using just the rotation angle. You don't need an origin vector. The least number of parameters you need is three. For example the three Euler angles or rotation axis and rotation angle (since rotation axis is a unit vector, the rotation angle can be encoded as the length of the vector). However it is often convenient to work with four parameters such as quaternions.
Modern approach is to avoid Euler angles, so my advise is to work with axis-angle parameters (kind of 3D angle) or quaternions (not just an angle representation but a whole algebra)