## Need help to get all possible 3d rotations?

### Need help to get all possible 3d rotations?

> Just curious, but would it be possible to instead iterate (by 1 degree
> using the original example) through latitude and longitudes (to get
> all axes for that increment), and also iterate angles on those axes to
> get all orientations?

What "those axes"?  Latitude and longitude are essentially two Euler
angles, the third being rotation around the vertical (compass heading,
sort of).  I.e. these are just new names for the same thing we've been
trying to convince the OP not to use...
--

Even if all the snow were burnt, ashes would remain.

### Need help to get all possible 3d rotations?

> > > > Macro,

> > > > the task is quite clear - finding all orientations in 1 steps.
> > > > If you want to cover all single axis rotations  as well, then you will
> > > > need 0..360 for each angle.
> > > > If you want all rigid body orientations, then this would be sufficient:
> > > > Psi=-180..+180
> > > > The= -90.. +90
> > > > Phi=-180..+180
> > > > Then you will have duplicate positions.
> > > Yes, that's what I meant.

> > > > Storing millions of rotation matrices doesnt look promissing.
> > > > If your body rotation is not physically restrained, then its IMO not
> > > > avoidable to allow full rotations for each angle.
> > > > You could do this by 3D tables in 10 steps and 3D linear interpolation
> > > > (45656 matrices with 9 single entries each). Unfortunately, the 3D inter-
> > > > polation is time consuming, and it has to be done for each of the nine
> > > > components.
> > > It may be too complicated :( . And if I change the interval, for instance,
> > > to 0.5 or 0.9 degrees, I have to re-do calculations  :(

> > > > There is nowhere gimbal lock. The pure geometrical rotation is well
> > > > defined for all arbitrary angles.

> > > > Quaternions are probably the best choice, without storing predefined
> > > > orientations.
> > > Any further hint? I searched this topic on the web, but most articles are
> > > about interpolation.

> > The problem with "finding all possible rotations in for instance 1
> > steps" without duplication is an ill-defined problem. The topological
> > structure of 3d-rotations corresponds to the structure of a
> > 4-dimensional sphere where any pair of opposite points represent the
> > same rotation. Another equivalent structure: The set of all straight
> > lines through the origin in 4d.

> > The structures of the set of rotations and the set of point pairs on a
> > 4d-sphere are equivalent in the sense that there is a one-to-one
> > mapping between point pairs and rotations such that point pairs that
> > are "close" in the geometrical sense correspond to rotations which are
> > "close" in terms of axis and angle.

> > As you may guess the mathematical objects linking point pairs on a 4d
> > sphere and 3d rotations, i.e. objects which can represent both kinds
> > of entities are - quaternions. Pairs of unit quaternions alias 4d unit
> > vectors, to be precise, because q and -q represent the same rotation
> > if interpreted as rotations and two opposite points on a 4d unit
> > sphere if interpreted as point pairs.

> > Now the problem boils down to representing pairs of 4d unit vectors
> > with a suitable parametrization.

> > A "natural" parametrization of one half of the 4d unit sphere without
> > duplication yielding a set of quaternions representing all possible 3d
> > rotations is a parametrization using 3 angles (which have no relation
> > to Euler angles and such) a1,a2,a3.

> >        x = sin(a1)sin(a2)sin(a3)
> >        y = sin(a1)sin(a2)cos(a3)
> >        z = sin(a1)cos(a2)
> >        w = cos(a1)

> >        0  <= a3 < pi
> >        0  <= a2 < pi
> >        0  <= a1 < pi

> > using a1 as inner, a2 as middle and a3 as outer loop.

> > Regards
> > Horst

> Just curious, but would it be possible to instead iterate (by 1 degree
> using the original example) through latitude and longitudes (to get
> all axes for that increment), and also iterate angles on those axes to
> get all orientations?

Why not. Using (x,y,z) as rotation axis and phi as rotation angle

x = sin(a1)sin(a2)
y = sin(a1)cos(a2)
z = cos(a1)

0 <= a1 < pi
0 <= a2 < pi
0 <= phi < 2pi

you could iteraterate through all rotations using a1,a2 and phi as
loop parameters.

Regards
Horst

### Need help to get all possible 3d rotations?

> > Just curious, but would it be possible to instead iterate (by 1 degree
> > using the original example) through latitude and longitudes (to get
> > all axes for that increment), and also iterate angles on those axes to
> > get all orientations?

> What "those axes"?  Latitude and longitude are essentially two Euler
> angles, the third being rotation around the vertical (compass heading,
> sort of).  I.e. these are just new names for the same thing we've been
> trying to convince the OP not to use...

I didn't explain myself very well. I realise there is no good 3
parameter characterisation of orientation in 3D (is there a proof of
this on the net somewhere by the way?), so there's a gap in my
knowledge somewhere. I'll try to describe what I was saying more fully
anyway, since I'm not sure whether it came across.

Say an orientation in 3D is given by an axis and angle. I'll break my
description (which was using 3 angles) down into those two parts
separately, to make it clearer.

First the axis of rotation.
I was describing an axis of rotation being given by a longitude and
latitude (call them Euler angles if you wish). With just those two
parameters, we can get to any point on a unit sphere, right?

This is the axis I meant when you ask "What 'those axes' ". I meant an
axis from the centre of the unit sphere to that point). The third
angle is *around that axis*. This gives us any orientation in 3D,
right?

That's what I meant the first time. It may (and likely is) just Euler
angles in disguise, you tell me.

Just as I post, Horst has also replied so I'll mull over that too. I'm
not sure where my confusion lies, making things doubly tricky :)

### Need help to get all possible 3d rotations?

> First the axis of rotation.
> I was describing an axis of rotation being given by a longitude and
> latitude (call them Euler angles if you wish). With just those two
> parameters, we can get to any point on a unit sphere, right?

You could do it that way, but you'ld just replace Baal by Beelzebub
then.  A "direction" is better represented as a unit-length vector,
for most purposes where utmost storage efficiency isn't your main
concern.  Yes, that's one more free variable than you actually need,
but it has the benefit of being uniquely defined for all non-zero
rotations, which a lat/long pair isn't --- there's no way to define
longitude at the poles.

Quote:> That's what I meant the first time. It may (and likely is) just Euler
> angles in disguise, you tell me.

It is.

--

Even if all the snow were burnt, ashes would remain.