Orientation & QuaternionsCSE169: Computer AnimationInstructor: Steve RotenbergUCSD, Winter 2008OrientationOrientation We will define ‘orientation’ to mean an object’s instantaneous rotational configuration Think of it as the rotational equivalent of positionRepresenting Positions Cartesian coordinates (x,y,z) are an easy and natural means of representing a position in 3D space There are many other alternatives such as polar notation (r,θ,φ) and you can invent others if you want toRepresenting Orientations Is there a simple means of representing a 3D orientation? (analogous to Cartesian coordinates?) Not really. There are several popular options though: Euler angles Rotation vectors (axis/angle) 3x3 matrices Quaternions and more…Euler’s Theorem Euler’s Theorem: Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis. Not to be confused with Euler angles, Euler integration, Newton-Euler dynamics, inviscidEuler equations, Euler characteristic… Leonard Euler (1707-1783)Euler Angles This means that we can represent an orientation with 3 numbers A sequence of rotations around principle axes is called an Euler Angle Sequence Assuming we limit ourselves to 3 rotations without successive rotations about the same axis, we could use any of the following 12 sequences:XYZ XZY XYX XZXYXZ YZX YXY YZYZXY ZYX ZXZ ZYZEuler Angles This gives us 12 redundant ways to store an orientation using Euler angles Different industries use different conventions for handling Euler angles (or no conventions)Euler Angles to Matrix Conversion To build a matrix from a set of Euler angles, we just multiply a sequence of rotation matrices together:⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−−++−=yxyxyzxzyxzxzyxzyzxzyxzxzyxzycccsscssscccsssscsscscsccsscc⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−⋅⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−⋅⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−=⋅⋅xxxxyyyyzzzzxyzcssccssccssc000010010010000RRREuler Angle Order As matrix multiplication is not commutative, the order of operations is important Rotations are assumed to be relative to fixed world axes, rather than local to the object One can think of them as being local to the object if the sequence order is reversedUsing Euler Angles To use Euler angles, one must choose which of the 12 representations they want There may be some practical differences between them and the best sequence may depend on what exactly you are trying to accomplishVehicle Orientation Generally, for vehicles, it is most convenient to rotate in roll (z), pitch (x), and then yaw (y) In situations where thereis a definite ground plane,Euler angles can actuallybe an intuitiverepresentationxyzfront of vehicleGimbal Lock One potential problem that they can suffer from is ‘gimbal lock’ This results when two axes effectively line up, resulting in a temporary loss of a degree of freedom This is related to the singularities in longitude that you get at the north and south polesInterpolating Euler Angles One can simply interpolate between the three values independently This will result in the interpolation following a different path depending on which of the 12 schemes you choose This may or may not be a problem, depending on your situation Interpolating near the ‘poles’ can be problematic Note: when interpolating angles, remember to check for crossing the +180/-180 degree boundariesEuler Angles Euler angles are used in a lot of applications, but they tend to require some rather arbitrary decisions They also do not interpolate in a consistent way (but this isn’t always bad) They can suffer from Gimbal lock and related problems There is no simple way to concatenate rotations Conversion to/from a matrix requires several trigonometry operations They are compact (requiring only 3 numbers)Rotation Vectors and Axis/Angle Euler’s Theorem also shows that any two orientations can be related by a single rotation about some axis (not necessarily a principle axis) This means that we can represent an arbitrary orientation as a rotation about some unit axis by some angle (4 numbers) (Axis/Angle form) Alternately, we can scale the axis by the angle and compact it down to a single 3D vector (Rotation vector)Axis/Angle to Matrix To generate a matrix as a rotation θaround an arbitrary unit axis a:⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−++−−−−−−++−+−−−−+)1()1()1()1()1()1()1()1()1(222222zzxzyyzxxzyyyzyxyzxzyxxxacasacaasacaasacaaacasacaasacaasacaaacaθθθθθθθθθθθθθθθRotation Vectors To convert a scaled rotation vector to a matrix, one would have to extract the magnitude out of it and then rotate around the normalized axis Normally, rotation vector format is more useful for representing angular velocities and angular accelerations, rather than angular position (orientation)Axis/Angle Representation Storing an orientation as an axis and an angle uses 4 numbers, but Euler’s theorem says that we only need 3 numbers to represent an orientation Mathematically, this means that we are using 4 degrees of freedom to represent a 3 degrees of freedom value This implies that there is possibly extra or redundant information in the axis/angle format The redundancy manifests itself in the magnitude of the axis vector. The magnitude carries no information, and so it is redundant. To remove the redundancy, we choose to normalize the axis, thus constraining the extra degree of freedomMatrix Representation We can use a 3x3 matrix to represent an orientation as well This means we now have 9 numbers instead of 3, and therefore, we have 6 extra degrees of freedom NOTE: We don’t use 4x4 matrices here, as those are mainly useful because they give us the ability to combine translations. We will not be concerned with translation today, so we will just think of 3x3 matrices.Matrix Representation Those extra 6 DOFs manifest themselves as 3 scales (x, y, and z) and 3 shears (xy, xz, and yz) If we assume the matrix represents a rigid transform (orthonormal), then we can constrain the extra 6 DOFsbacacbcbacba×=×=×==== 1Matrix Representation Matrices are usually the most computationally efficient way to apply rotations to geometric data, and so most orientation representations
View Full Document