How to calculate the axis of rotation around this discrete 3D spiral and how much would I need to rotate it to meet a certain condition

linear algebramatricesmatrix-calculusrotations

In a previous question, I asked about calculating the center of a discrete 3D spiral and eventually got a working solution. Now I'm trying to find the axis line it creates and how much I would need to spin it so the 2nd cube moves to where the first cube was. I'll explain what I mean by that more towards the end. First, some background.

Background

I'm more of an artist than a mathematician so bare with me. I have taken Calc 2 in university but that was 8 years ago and we never did anything with vectors or linear algebra.

Say we have a discrete spiral like in the video below. It is formed by placing a 1 meter cube at the origin. Then, the next cube has some translation, rotation, and a scaling factor that is between 0 and 1. Then this process repeats but the translation and scaling vectors are scaled down each time. It eventually comes to a point that I can now calculate with some code thanks to some brilliant people.

A typical spiral

This might help you understand how it's formed

Questions

  1. I'm now trying to find the red line in the image below so I can spin it around that axis. I'm guessing two of the three rotation axes will be used to put the line into the correct orientation and then the third will be used to sweep it around the axis. My software (Blender) can handle different rotation modes (Quaternion, various Euler rotations, and "axis angle"). Blender is free and I don't mind sharing the file if helps you understand the problem. Just let me know.

The red line is what I'm trying to find. This one was placed by hand.

  1. How much would I need to spin it? Since I'm scaling each cube down by say $k$, if I scale the whole spiral up by $1/k$ from the center of the spiral, then the 2nd cube become 1 meter (the 1st cube's original size). Then, if I spin it in the right amount, it's position would go to the 1st cube's original position. The 2nd cube basically moves to where the 1st cube was and matches it's scale and orientation. All the other cubes would do a similar thing. The $nth$ cube would move to the $n – 1$ cube. If it's done at a specific rate (which I already know the formula to), it'll make a really cool looping effect. These are often only done along one or two dimensions since the 3D solution is so difficult to calculate. Hence me being here. If I can get an answer, I'll share this with the art community and become a legend. I'm hoping the answers to these two questions will fix a problem I'm having.

I should note that I'm assuming that above is true. It makes intuitive sense to me since the works like that in 2D. And I can already kinda do it but it doesn't work quite right. See below.

Problem I'm having

What I'm currently doing is close but doesn't work perfectly. I thought I would be able to use the starting rotation but it makes a sharp transition (see below). Instead of spinning it around the axis, I'm taking the rotation values that generated the spiral (the rotation vector of the 2nd cube) and subtracting them from the rotation vector of the spiral center. The 2nd cube goes back to the first which is good but doesn't do so *smoothly*. Smoothness is mission critical to making these loops feel nice.

An example of the sharp transition. It appears to bounce. Not ideal.

Update

I've made a video to help explain what I trying to do in case there is any confusion. I think the amount I need to rotate it in, is the original rotation amount but it needs to be converted so rotating only 1 axis (the axis around the center of the spiral) undoes the original rotation.

I'm not sure how to tag this question. Feel free to edit it if needed.

Best Answer

I found a solution thanks to u/1184x1210Forever on Reddit.

And it's surprisingly simple. If I convert the rotation matrix on the Parameters object from XYZ Euler to Axis-Angle ($W+XYZ$ where $XYZ$ is a 3D Vector), then the axis that runs through the spiral is that 3D Vector and the amount I need to rotate to undo the original rotation becomes $-W$.

Related Question