# Thread: Point on a Circle that may rotate on X, Z, and Y axis

1. ## Point on a Circle that may rotate on X, Z, and Y axis

I'm a little ashamed that I must ask for help on this, but I will describe what I am doing for you and hopefully you can point me in the right direction. Maybe you learn something too.

My program is using 6 points on 3 circles for a physics proxy (or a "zone" system). This is because the zone must be able to rotate. This isn't particularly relevant to the math problem.

Do not mind 4 of those points for now since if I figure this out, I am sure I can figure them out.
I am trying to solve 3-axis rotation for 1 particular circle. By default, its factor for the Z axis is supposed to be 1, the Y axis is supposed to be zero, and the X axis is also supposed to be zero. The inverse of this point is found by changing the sign (thus two points).

The function for the X position of these points is currently:
( sin(x) * cos(y + z) ) + ( sin(y) * sin(z) ) + ( sin(x) * sin(y) * sin(z) )
This, as far as I can tell, is correct. It's probably not efficient or concise, but it does work.

The function for the Z position of these points is currently:
cos(z) * cos(x)
Which, as far as I can tell, is correct.

The function for the Y position of the points is currently:

( sin(x) * sin(y) * -sin(90 - sqrt(z * y)) ) + ( (sin(z) * cos(y) )

This is NOT correct, and is a problem. Oddly, it is correct if each axis of rotation is all the same, and is also correct for single-axis rotation. The problem axis of rotation appears to be Y.
If, for example, X rotation is 75, Y rotation is 75, and Z rotation is 30..
The outcome of the function should be 0.678605...
The outcome of the function is instead 0.50665...

The difference in the outcome of the function from what it should be is 0.171955.... for these particular angles.

It's been 3 days with this
I do not know what relationship of sines would equal or change by 0.171955

Can anyone add or remove the sines/cosines/tangents from the following function such that the following function produces the correct point rotated on 3 axis?
( sin(x) * sin(y) * -sin(90 - sqrt(z * y)) ) + ( (sin(z) * cos(y) )

2. ## Re: Point on a Circle that may rotate on X, Z, and Y axis

Well, what I've since done is axed those functions down and tried to focus on 2-axis rotations only.

Once I complete that, hopefully some wisdom of the 3rd axis will be gleamed.

3. ## Re: Point on a Circle that may rotate on X, Z, and Y axis

I would recommend starting with this entry:
https://en.wikipedia.org/wiki/Rotation_matrix

It appears you want

$R_x(75^\circ)R_y(75^\circ)R_z(30^\circ) = \begin{pmatrix}1 & 0 & 0 \\ 0 & \tfrac{ \sqrt{3}-1}{2\sqrt{2}} & -\tfrac{1+\sqrt{3}}{2\sqrt{2}} \\ 0 & \tfrac{1+\sqrt{3}}{2\sqrt{2}} & \tfrac{ \sqrt{3}-1}{2\sqrt{2}}\end{pmatrix}\begin{pmatrix}\tfrac{ \sqrt{3}-1}{2\sqrt{2}} & 0 & \tfrac{1+\sqrt{3}}{2\sqrt{2}} \\ 0 & 1 & 0 \\ -\tfrac{1+\sqrt{3}}{2\sqrt{2}} & 0 & \tfrac{ \sqrt{3}-1}{2\sqrt{2}}\end{pmatrix}\begin{pmatrix}\tfrac{ \sqrt{3}}{2} & -\tfrac{1}{2} & 0 \\ \tfrac{1}{2} & \tfrac{ \sqrt{3}}{2} & 0 \\ 0 & 0 & 1\end{pmatrix}$

This rotation matrix can then be multiplied by the vector representing the point you want to rotate, which you described as $\begin{pmatrix}0\\0\\1\end{pmatrix}$.

This gives the rotated point:
$\begin{pmatrix}\tfrac{\sqrt{2}+\sqrt{6}}{4} \\ -\tfrac{1}{4} \\ \tfrac{2-\sqrt{3}}{4}\end{pmatrix}$