My Math Forum Extracting Eulers from Two Ordered Bases

 Linear Algebra Linear Algebra Math Forum

 July 12th, 2017, 05:04 PM #1 Newbie   Joined: Dec 2014 From: Tennessee Posts: 4 Thanks: 0 Extracting Eulers from Two Ordered Bases Okay, it's been years since I've been here, but I suppose better back late than never. I've got a nettlesome problem, and I'm wondering if there's a good answer. It's going to take a bit of setup to explain it though. First, we've got to conceptualize an ordered basis (or just basis) in 3D space. It's something like this... If you study it, you'll see that it can be defined by four points: An Origin, an AxisX, and AxisY, and an AxisZ in 3D space. Now, I don't care about the origin, so let's just assume that all the bases are sitting on a <0,0,0> origin. That'll simplify things a bit. Now, let's assume we've got two of these things (bases) and that they're rotated (oriented) differently from each other. We'll call one the Parent and the other the Child. We can now imagine extracting a set of Euler angles from these Parent and Child bases that would tell us how to rotate the Parent to agree with the Child. I can get all that done, but here's my problem: There is more than one way to represent the Eulers between two bases. Just to illustrate the problem in the simplest way. Let's say that our two bases are actually rotated in exactly the same way. In this case, the obvious set of Eulers would be <0°,0°,0°>. However, as an alternative, we could also say <180°,180°,180°>. Here's my problem/question. When extracting the Eulers between two bases, is there some standard way to represent the Eulers? To expound some more, I'm trying to write some code that emulates some other extremely vetted code (to which I don't have the source). The vetted code returns these Eulers between two bases: <-161.4196° 98.9894° -160.3156°> And my code returns these Eulers: <18.5804°, 81.0106°, 19.6844°> At first glance, they're nothing alike. However, if we study them more, we'll find that the second set is the same as the first set, with just some 180° offsets. Therein lies my dilemma. Is there an order here I'm missing? I really need to get the exact same results as this vetted software. I would provide some extra code, but I think that brings in complexity that's not necessary. Hopefully I've explained the problem adequately. Thanks In Advance, Elroy
 July 13th, 2017, 03:08 AM #2 Global Moderator   Joined: Dec 2006 Posts: 18,725 Thanks: 1536 If you get different Euler angles, you're using different definitions.
July 13th, 2017, 03:14 AM   #3
Senior Member

Joined: Apr 2014
From: Glasgow

Posts: 2,094
Thanks: 702

Math Focus: Physics, mathematical modelling, numerical and computational solutions
Quote:
 Originally Posted by elroy To expound some more, I'm trying to write some code that emulates some other extremely vetted code (to which I don't have the source). The vetted code returns these Eulers between two bases: <-161.4196° 98.9894° -160.3156°> And my code returns these Eulers: <18.5804°, 81.0106°, 19.6844°> At first glance, they're nothing alike. However, if we study them more, we'll find that the second set is the same as the first set, with just some 180° offsets. Therein lies my dilemma. Is there an order here I'm missing? I really need to get the exact same results as this vetted software.
I've never heard of "Euler" being used as a noun for anything. I think what you're probably referring to are rotational transformations which, in Unity for example, can be set by specifying a vector representing an axis and an "Euler angle". The reason for this name is to distinguish it from quaternions, angles which use a different set of mathematics to perform rotational transforms.

The order of a set of rotations matter, so the angles you are obtaining by doing different rotations will be different. I would have to take a look at your code to see what you're trying to do and diagnose any difficulties (which I don't have time for right now unfortunately), but perhaps you're doing some 180 degree rotations because the angles you have in the second set can be obtained by either adding or subtracting 180 degrees from the angles in the first set. Chances are you're not far off.

If you're trying to reverse engineer a function that returns angles, you also need to be careful about which quadrants the arcsin, arccos and arctan functions are returning.

 July 19th, 2017, 04:05 PM #4 Newbie   Joined: Dec 2014 From: Tennessee Posts: 4 Thanks: 0 Hello Benit13, I apologize if I offended your sensibilities in using Euler as a noun. I was just being terse in my reference to Euler angles. And also, yes, I'm quite familiar with quaternions, using quaternions to rotate a vector, developing transformation (translation and rotation) matrices. But that's not my problem here. Also, my routines have an additional constant (from a set of constants) that is supplied as an argument. These constants are xyz, xzy, yzx, yxz, zxy, & zyx. What these do is define the order in which the Eulers (oops, Euler angles) are extracted. Therefore, all the basis are covered. But that's still not my problem. Let me give a bit of an example. Let's say I've got two ordered bases (see above), we'll call one a parent and the other a child. I'd like to know the Euler angles that it'd take to rotate the parent to match the child. One piece of software returns <-0161.4196, 0098.9894, -0160.3156>. And my software is returning <18.58055, 80.86269, 19.67698>. Now, there are other IEEE rounding issues having to do with the fact that the other software is doing everything in four-byte singles, and I'm using eight-byte doubles. But that's beside the point. If we look at the original numbers, we find that the following transformation will bring us to the numbers I calculated: 180+x , 180-y, 180+z Now, I've got this thing I keep on my desk: If you go through that transformation, you wind up back at the same spot. Therefore, the Euler angles are, in a certain sense, equivalent. However, I use them to denote actual human body joint motions. Let's say that rotations around the X axis of a segment (i.e., joint) represent sagittal kinematics. And let's say that the first method (above) returned -40. And then, we transform and get +140. For a joint, -40 is a very different motion than +140. Therein lies my problem. Best Regards, Elroy

 Tags bases, eulers, extracting, ordered

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post harley05 Differential Equations 1 April 1st, 2015 06:51 AM mathbalarka Number Theory 15 May 30th, 2012 10:20 PM Sirjon Algebra 0 September 1st, 2010 06:17 PM The HitchHiker Computer Science 0 August 18th, 2008 01:12 AM The HitchHiker Complex Analysis 0 August 18th, 2008 01:08 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top