CTrackKeyFramerBezier< CKeyBezierQuat, CQuat > Class Reference

#include <track_bezier.h>


Detailed Description

ITrack implementation for Bezier Quaternion keyframer.

Author:
Lionel Berneguier

Nevrax France

Date:
2001

Definition at line 131 of file track_bezier.h.

Public Member Functions

virtual const IAnimatedValue & getValue () const
 From ITrack.


Protected Member Functions

From ITrackKeyFramer
virtual void compile ()
 compile (precalc).

virtual void evalKey (const CKeyBezierQuat *previous, const CKeyBezierQuat *next, TAnimationTime datePrevious, TAnimationTime dateNext, TAnimationTime date)
 evalKey (runtime).


Private Attributes

CAnimatedValueBlendable< CQuat > _Value


Member Function Documentation

virtual void CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >::compile  )  [inline, protected, virtual]
 

compile (precalc).

Definition at line 172 of file track_bezier.h.

References r, and sint.

00173         {
00174                 ITrackKeyFramer<CKeyBezierQuat>::compile();
00175 
00176                 // makeclosest quaternions, Tangents Precompute.
00177                 sint    nKeys= _MapKey.size();
00178                 if(nKeys<=1)
00179                         return;
00180 
00181                 TMapTimeCKey::iterator  it;
00182                 TMapTimeCKey::iterator  itNext;
00183                 TMapTimeCKey::iterator  itPrev;
00184 
00185                 it= _MapKey.begin();                            // first key.
00186                 itNext= it;     itNext++;                               // second key.
00187                 itPrev= _MapKey.end();                          // end key.
00188 
00189                 // Compute all keys.
00190                 for(;it!=_MapKey.end();)
00191                 {
00192 
00193                         CKeyBezierQuat  &key= it->second;
00194                         CQuat   &cur= key.Value;
00195 
00196                         if(itPrev!= _MapKey.end())
00197                         {
00198                                 cur.makeClosest(itPrev->second.Value);
00199                         }
00200 
00201                         CQuat   prev, next;
00202 
00203                         // compute prev / next.
00204                         if(itPrev!= _MapKey.end())
00205                                 prev= itPrev->second.Value;
00206                         else
00207                                 prev= itNext->second.Value;
00208                         if(itNext!= _MapKey.end())
00209                                 next= itNext->second.Value;
00210                         else
00211                                 next= itPrev->second.Value;
00212 
00213                         // Compute A.
00214                         CQuat qm,qp,r;
00215 
00216                         qm = CQuat::lnDif(cur, prev);
00217                         qp = CQuat::lnDif(cur, next);
00218                         r = -.25f*(qm+qp);
00219                         key.A= cur*(r.exp());
00220 
00221                         // Next key!!
00222                         itPrev= it;
00223                         it++;
00224 
00225                         if(itNext!= _MapKey.end())
00226                                 itNext++;
00227                 }
00228 
00229         }

virtual void CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >::evalKey const CKeyBezierQuat *  previous,
const CKeyBezierQuat *  next,
TAnimationTime  datePrevious,
TAnimationTime  dateNext,
TAnimationTime  date
[inline, protected, virtual]
 

evalKey (runtime).

Definition at line 147 of file track_bezier.h.

References NLMISC::clamp().

00150         {
00151                 if(previous && next)
00152                 {
00153                         // lerp from previous to cur.
00154                         date-= datePrevious;
00155                         date*= previous->OODeltaTime;
00156                         NLMISC::clamp(date, 0,1);
00157 
00158                         // quad slerp.
00159                         _Value.Value = CQuat::squad(previous->Value, previous->A, next->A, next->Value, date);  
00160                 }
00161                 else
00162                 {
00163                         if (previous)
00164                                 copyToValue(_Value.Value, previous->Value);
00165                         else
00166                                 if (next)
00167                                         copyToValue(_Value.Value, next->Value);
00168                 }
00169         }

virtual const IAnimatedValue& CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >::getValue  )  const [inline, virtual]
 

From ITrack.

Definition at line 136 of file track_bezier.h.

00137         {
00138                 return _Value;
00139         }


Field Documentation

CAnimatedValueBlendable<CQuat> CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >::_Value [private]
 

Definition at line 234 of file track_bezier.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 06:43:54 2004 for NeL by doxygen 1.3.6