; docformat = 'rst' ;+ ;This function combines either two rotational matrices or two quaternions. ;The two inputs must agree in their type (either they are both matrices or ;they are both quaternions). ; ; :Examples: ; mat_com = combine_rotation(mat1, mat2) ;- ;+ ; :Params: ; T1 : in, required, type=array of double ; Either a 9 element rotational matrix or a 4 element quaternion of ; the form [3D vector, scalar]. ; T2 : in, required, type=array of double ; Either a 9 element rotational matrix or a 4 element quaternion of ; the form [3D vector, scalar]. ; ; :Returns: ; Returns either a combined rotational matrix or a combined quaternion. ;- function combine_rotation,T1,T2 if(n_elements(T1) ne n_elements(T2)) then begin message,/error,'Two transformations of different type' return,-1 end if(n_elements(T2) eq 9) then begin ;It's a matrix return,T2 ## T1 end else begin ;It's a quaternion return,quat_mult(T1,T2); end end