home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
octa21eb.zip
/
octave
/
SCRIPTS.ZIP
/
scripts.fat
/
quatern
/
qinv.m
< prev
next >
Wrap
Text File
|
1999-04-29
|
289b
|
13 lines
function retval = qinv(q)
# function b = qinv(q)
# return the inverse of a quatern
# 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 quatern passed!");
end
endfunction