# HPB to Tait-Bryan rotations

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/05/2008 at 22:07, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R9-R10.5
Platform:   Windows  ; Mac  ;  Mac OSX  ;
Language(s) :     C++  ;

---------
Okay. It took me years to understand this stuff a little better (I literally hate 3D rotations). First, reading the C4D manual "Coordinate System: Why use HPB?" cleared up some serious misunderstandings. First, it says that C4D always stores the representation as HPB internally. That I figured. The second thing it says is something about how the rotations are about the parent's system (at least two of them anyway?). That got me thinking here.

C4D HPB - rotations about parent system.
Tait-Bryan - rotations about local system (which gives you that beautiful gimbal lock).

Now, Tait-Bryan rotations are so-called Euler 1-2-3 rotations. That is XYZ, XZY, YXZ, YZX, ZXY, ZYX. These are ordered, non-communative, and non-communative from one order to another (as far as I know).

So, now that I can frame the question a bit more knowledgeably, here goes. ;)

1. How the fiddle-sticks do I convert HPB rotations (probably from what is stored in the local matrix or derived from GetRot() and HPBToMatrix()) into Tait-Bryan rotations accurately and without these anomalies?:

(90°, 45°, −105°) ≡ (−270°, −315°, 255°) multiples of 360°
(72°, 0°, 0°) ≡ (40°, 0°, 32°) singular alignment
(45°, 60°, −30°) ≡ (−135°, −60°, 150°) bistable flip

These are pretty much what I see in my matrix decompositions of the HPB matrix but my results may more likely be a result of the fact that these two rotation systems have these differing interpretations which I have not taken into account - and aren't accounted for in other Matrix-to-Euler conversion algorithms (namely the systems being rotated?). There must be a difference in the matrices since the results speak for themselves - years of failure.

Two other questions:

2. Is there a more specific name for your HPB system (since 'HPB' seems to be practically ubiquitous everywhere as a usual Euler rotation system yet associated with gimbal lock). I can't find any so-called HPB system that doesn't describe itself as a typical Euler rotation system which suffers the same anomalies as others. Any accessible documentation or books or papers that give a more thorough explanation. Considering the myriad forms and names and symbologies and representations of 3D rotations (and the gazillions of books, papers, online resources), it is hard to find *the* system upon which your HPB is based. You say that it is hard to understand. It would be easier if the details were laid bare from their source.

3. Although you'd like to think that this isn't your problem, the fact that I can't find any conversion/decomposition algorithms that consider a change in coordinate system (as odd as yours) in the extraction of Euler rotations suggests that would you consider, please, supplying some information in this regard? (like how I finegalled that into a question) ;)

You can see that I'm obsessed and resilient with this pursuit of mine. The reason is that it would open up multitudes of doorways that are currently locked tight. I had to implement my own rotation tools since there has been no way to go HPB->TB (a darned lot of work). I had to implement (badly) an IK system since there has been no way to go HPB->TB (a lot of work for little success). Users cannot use things like CactusDan's CD plugins because of this. Users can't animate HPB but only the TB representations.

Looking at the code such as MatrixToHPB() doesn't really *tell* me anything. This stuff is sooo complex, yes, I really need hand-holding to find the path to results.

ETA: And even here the terminology befuddles all senses. Supposedly, Tait-Bryan is akin to your HPB (where I have read otherwise) and Euler 1-2-3 is just Euler - or is it or is it something else. My god people (generally - mathematicians), please consolidate your definitions and stop bandying them about in misconstruing ways. This is one reason why I HATE 3D rotations. Standards, we don't need no shtinkin' standards... (just do some comparative readings and you'll see how fragged up it is).

Thanks,

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/05/2008 at 22:31, xxxxxxxx wrote:

This Wiki has an interesting mention:

Rotation representation

So, assuming that you are using Tait-Bryan rotations and knowing that I'm using strict Euler rotations, how does one go from yours to mine? ;D

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/05/2008 at 11:57, xxxxxxxx wrote:

Well... ;)

At least, could you point me to textbook references where I can get down to learning this stuff? Sorry, things like precession/nutation/intrinsic rotations, S1/S2/S3 frames, fixed vs. moving frames, commutative Euler rotation systems aren't discussed in non-mathematical-geared high school courses - and, no, I don't have a PhD in anything. :) This is at least second or third year college/university material with a gear towards mathematics (computer science/software engineering) - since I only hear about stuff like this from people like Ken Shoemake (PhD in MATHEMATICS) one suspects that you'd not see it until your Masters years. Not discussed in any of my 70 books on 3D graphics or mathematics in detail (or at all) - some of the best 3D CG books available.

So, it's either I take 12 years of university to get a PhD in Mathematics - or you start helping me...

Thanks,

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/05/2008 at 14:14, xxxxxxxx wrote:

Howdy,

Well, I wish I could help, but mostly what I've learned about rotation is: "Rotations in 3D are EVIL!" :D

Have you looked at the c4d_tools.cpp file in the api folder? The function code for MatrixToHPB() should give you a pretty good idea of how Cinema 4D is deriving Euler angles from a matrix.

I don't know how much help that will be. :(

Cactus Dan

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/05/2008 at 14:33, xxxxxxxx wrote:

I agree with your learning. :)

That code doesn't help me much. The main thing about C4D's HPB rotation is that it is communative because it is using, I think, moving-frame rotation on the parent system rather than fixed-frame rotation of the object system.

The problem is that this stuff gets really complicated fast - I've scanned through the Wikis on "Rotation Representation", "Euler Angles", and "Tait-Bryan Angles" without understanding most of it. I'd need very explicit descriptions of these systems - pictures always help. ;) Whereas most sources are vague and confused/ing, the others that are more useful are impossible to understand without background information that seems to be assumed.

So, the problem is in how to make correspondences between C4D-HPB and Euler-ordered considering these things. Since C4D only returns HPB angles, I'd need to do the code myself from a basis that is mathematically sound (if even possible).

ETA: See, this is where terminology gets *really* confusing. C4D doesn't return Euler angles per se. It returns a special type of Euler angles that is communative due to the way it operates and avoids gimbal lock. My Euler angles are simple ordered-axis angles that are neither communative nor avoid gimbal lock. Unfortunately, there are very many so-called 'Euler' rotation systems. Many people referring to HPB mean a standard YXZ system (with gimbal lock) while others mean something else. This goes back to my earlier noted frustration.