Directory: general/misc/quaternion/
Contents
.pro files
- mtoq.pro
Function: mtoqPurpose: transforms a rotation matrix into a quaternion.
- qang.pro
Function: qang,qPurpose: calculate the angle of a unit quaternion or an array of unitquaternionsInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: phi where q = [cos(phi/2),V*sin(phi/2)] throws error of failure, because negative one could be an acceptable return valueNotes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qcompose.pro
Function: qcompose,v,thetaPurpose: compose quaternions from vectors and anglesInputs: vec: 3 element array or an Nx3 element array theta: an angle or an N element array of angles(in radians)Keywords: free: Flag to allow thetas outside [0,pi)Returns: a 4 element quaternion or an Nx4 element array of quaternions;Notes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qconj.pro
Function: qconj,qPurpose: calculate the conjugate a quaternion or an array of quaternionsInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: q*Notes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qdecompose.pro
Function: qdecompose,qPurpose: decompose quaternions into axes and angelesInputs: q: a 4 element quaternion or an Nx4 element array of quaternionsReturns: a 4 element array with a[0] = angle, and a[1:3] = axis, oran Nx4 element array or -1L on failure;Notes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsAs per the euve implementation, if q[0] is outside of the range ofacos...[-1,1] the value of the quaternion will be turned into anidentity quaternion...in other words clipped, this seems suspect,a better solution may be to wrap the value back into range usingmodular arithmatic, future modifiers of this routine should consideradding this.
- qdiv.pro
Function: qdiv,q1,q2Purpose: divide q1 by q2, in other words returns a quaternion q3s.t.
- qdotp.pro
Function: qdotp,q1,q2Purpose: calculate the dot product of two quaternions or two arrays of quaternionsInputs: q1: a 4 element array, or an Nx4 element array, representing quaternion(s) q2: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: q1.q2, or -1 on failure;Notes:Represention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsThe scalar component can be thought of as the amount of rotation thatthe quaternion performslike any vector the if t = the angle between q1 and q2 in 4-spacethe q1.q2 = ||q1||*||q2||*cos(t) where || denotes the norm(length) ofthe quaternion in 4-spaceWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: aaflores $ $LastChangedDate: 2012-01-23 16:50:12 -0800 (Mon, 23 Jan 2012) $ $LastChangedRevision: 9593 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/misc/quaternion/qdotp.pro $
- qinv.pro
Function: qinv,qPurpose: calculate the inverse of a quaternion or an array of quaternionsInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: q^-1Notes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qmult.pro
Function: qmult,q1,q2Purpose: multiply two quaternions or two arrays of quaternionsInputs: q1: a 4 element array, or an Nx4 element array, representing quaternion(s) q2: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: q1*q2, or -1 on failure;Notes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qnorm.pro
Function: qnorm,qPurpose: calculate the norm a quaternion or an array of quaternionsInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: norm(q): sqrt(a^2+b^2+c^2+d^2) or -1L on fail will be a single element or an N length arrayNotes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsThis implementation of norm does not apply the squareroot sometimesapplied to a norm.
- qnormalize.pro
Function: qnormalizePurpose: normalize a quaternion or an array of quaternionsInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s)Returns: q/(sqrt(norm(q))) or -1L on failNotes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- qslerp.pro
Function: qslerp,q,x1,x2Purpose: uses spherical linear interpolation to interpolatequaternions between elements of qInputs: q: an Nx4 element array, representing a list of quaternionswith N > 1, all quaternions must be unit quaternions(ie length/norm = 1) x1: The input abscissa values of the quaternions,an array of length N, abscissa values must also be monotonic x2: The output abscissa values for the quaternions, can have as many elements as wanted but must fall on the interval [x[0],x[N-1]], an M element array, abscissa values must also be monotonic geometric(optional): this keyword allows you to specify that it use the geometric formula for the slerp.
- qslerp_tests.pro
- qtom.pro
Function: qtomPurpose: transforms quaternions into rotation matricesInputs: a 4 element array representing a quaternion or an Nx4 elementarray representing an array of quaternionsReturns: a 3x3 matrix or an Nx3x3 arrayNotes: Implementation largely copied from the euve c library forquaternionsRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $
- quaternion_rotation.pro
Function quaternion_rotation,v,qUsage: v_prime = quaternion_rotation(v,q)Purpose: Rotate a vector v using the quaternion qInputs: v: a 3 element array, or an Nx3 element array, representing the vectors q: a 4 element array, or an Nx4 element array, representing UNIT quaternion(s)Alternatively- If last_index=1 then: arrays can be v: 3xN element array Q: 4xN element arrayWritten by: Davin Larson $LastChangedBy: davin-mac $ $LastChangedDate: 2014-04-18 13:05:24 -0700 (Fri, 18 Apr 2014) $ $LastChangedRevision: 14862 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/misc/quaternion/quaternion_rotation.pro $
- qvalidate.pro
Function: qvalidate,q,argname,fxnamePurpose: validate inputs for the idl quaternion libraryInputs: q: a 4 element array, or an Nx4 element array, representing quaternion(s) argname: the name of the argument to be used in error messagesReturns: an Nx4 array or -1, it will turn 4 element quaternion arrays into 1x4 element quaternion arraysNotes: This function is here because I noticed a lot of the errorchecking code was being repeated, and it was making the functionslong and hard to readRepresention has q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector component of the quaternion can also be thought of asan eigenvalue of the rotation the quaterion performsWritten by: Patrick Cruce(pcruce@igpp.ucla.edu) $LastChangedBy: pcruce $ $LastChangedDate: 2007-11-11 17:12:08 -0800 (Sun, 11 Nov 2007) $ $LastChangedRevision: 2027 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $