comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Quaternion spherical interpolation in PV-Wave
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Quaternion spherical interpolation in PV-Wave [message #63550] Tue, 11 November 2008 14:18
ez569x is currently offline  ez569x
Messages: 2
Registered: November 2008
Junior Member
I have been been a user of PV-Wave for the last seven years. Let me
say here that without this newsgroup's help, I probably wouldn't have
lasted seven months. I've learned a great deal from all the valuable
posts and been inspired to implement many routines. It's time to
donate back.
PV-Wave doesn't have any quaternion routines. Craig Markwardt does.
I've implemented his routines, but the only one that needed some
tweaking was QTERP. Thanks to Craig for validating my results.

function qterp, t0,q0,t1,qdiff=qdiff,reset=reset,slerp=slerp
; This function has been modified for implementation
; in PV-Wave from the original written by Craig Markwardt.
; Many thanks to him for his help verifying this implementation.
; All other quaternion routines are as originally written.
nq=n_elements(q0)/4
if nq eq 0 then begin
print,'no q input, stopping...'
return, -1
endif
if nq eq 1 then return,rebin(reform(q0,4,1),4,n_elements(t1))
if keyword_set(slerp) then begin
if n_elements(qdiff)/4 ne nq-1 or keyword_set(reset) then begin
qdiff=qtmult(q0(*,0:nq-2),/inv,q0(*,1:*))
wh=where(qdiff(3,*) lt 0,ct)
if ct gt 0 then qdiff(*,wh)=qdiff(*,wh)
endif
ii=floor(mgh_locate(t0,xout=t1)) < (nq-2) > 0 ; mark hadfield
hh=(t1-t0(ii)/(t0(ii+1)-t0(ii))
return,qtmult(q0(*,ii),qtpow(qdiff(*,ii),hh))
endif
q1=(q0(*,0)#t1)*0
for i=0,3 do q1(i,*)=spline(t0,q0(i,*),t1)
tot=sqrt(total(q1^2,d=0))
for i=0,3 do q1(i,*)=q1(i,*)/tot
return,q1
end

Regards,
SpinMan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Workbench: Run idl several times
Next Topic: Empty arrays?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:05:21 PDT 2025

Total time taken to generate the page: 0.00542 seconds