0
$\begingroup$

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!

$\endgroup$
  • $\begingroup$ Well, I'd recommend using either matrix rotations with Euler angles, or quaternions. Quaternions have a theoretical and practical advantage: no gymbal lock. $\endgroup$ – Adrian Keister Jan 28 '19 at 17:04
0
$\begingroup$

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)

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

The struggle has come to an end. I've followed Mauricio's suggestion and found a solution based on Euler-angles.

Am applying this algorithm to the vector I have as the "direction vector" and the normal of the mentioned plane as the "up vector": https://stackoverflow.com/questions/21622956/how-to-convert-direction-vector-to-euler-angles The resulting Euler angles can then be applied to any point to reproduce their rotation. Smooth and thanks :)

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.