0

I have a quaternion, q, and I need to determine if it is rotated beyond a certain number of degrees past level in both the X/Y axes. Any easy shortcut would obviously be to convert the quat to x/y/z Euler angles and then compare x/x values to the angle limits, but I'm wondering if there is a cleaner way to do this.

chris12892
  • 1,634
  • 2
  • 18
  • 36

2 Answers2

0

The better solution should be to find exact angle between your quaternion and Identity one.

I don't know which Quaternion implementation do you use, many of them have some helper methods to compute such things. If your implementation doesn't support this you can look at this answer for help.

Community
  • 1
  • 1
kolenda
  • 2,741
  • 2
  • 19
  • 30
0

Take a look at "swing twist decomposition", it split rotation with two component

Decompose the rotation on to 2 parts. 1. Twist - rotation around the "direction" vector 2. Swing - rotation around axis that is perpendicular to "direction" vector The rotation can be composed back by rotation = swing * twist

Component of a quaternion rotation around an axis http://www.euclideanspace.com/maths/geometry/rotations/for/decomposition/

Community
  • 1
  • 1
minorlogic
  • 1,872
  • 1
  • 17
  • 24