home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
octa21eb.zip
/
octave
/
SCRIPTS.ZIP
/
scripts
/
quaternion
/
qinv.m
< prev
next >
Wrap
Text File
|
1998-10-23
|
283b
|
13 lines
function retval = qinv(q)
# function b = qinv(q)
# return the inverse of a quaternion
# q = [w,x,y,z] = w*i + x*j + y*k + z
# qmult(q,qinv(q)) = 1 = [0 0 0 1]
if(norm(q) != 0)
retval = qconj(q) /sum(q .* q);
else
error("qinv: zero quaternion passed!");
end
endfunction