NL3D::CSpinnerFunctor Class Reference

#include <ps_plane_basis_maker.h>


Public Member Functions

 CSpinnerFunctor ()
 ============================================================================

const NLMISC::CVector getAxis (void) const
 get the rotation axis

const uint32 getNumSamples (void) const
 ============================================================================

const CPlaneBasisoperator() (float date) const
void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 ============================================================================

void setAxis (const NLMISC::CVector &axis)
 ============================================================================

const void setNumSamples (uint32 nbSamples)
 ============================================================================


Protected Member Functions

void updateSamples (void)
 ============================================================================


Protected Attributes

NLMISC::CVector _Axis
uint32 _NbSamples
CPSVector< CPlaneBasis >::V _PBTab


Constructor & Destructor Documentation

NL3D::CSpinnerFunctor::CSpinnerFunctor  ) 
 

============================================================================

Definition at line 297 of file ps_plane_basis_maker.cpp.

00297                                  : _NbSamples(0), _Axis(NLMISC::CVector::K)
00298 {       
00299 }


Member Function Documentation

const NLMISC::CVector NL3D::CSpinnerFunctor::getAxis void   )  const [inline]
 

get the rotation axis

Definition at line 195 of file ps_plane_basis_maker.h.

00195 { return _Axis;}

const uint32 NL3D::CSpinnerFunctor::getNumSamples void   )  const
 

============================================================================

Definition at line 317 of file ps_plane_basis_maker.cpp.

References _NbSamples, and uint32.

00318 {
00319         return _NbSamples;
00320 }

const CPlaneBasis& NL3D::CSpinnerFunctor::operator() float  date  )  const [inline]
 

Definition at line 191 of file ps_plane_basis_maker.h.

References NLMISC::OptFastFloor().

00191 { return _PBTab[NLMISC::OptFastFloor(date * _NbSamples)]; }

void NL3D::CSpinnerFunctor::serial NLMISC::IStream f  )  throw (NLMISC::EStream)
 

============================================================================

Definition at line 323 of file ps_plane_basis_maker.cpp.

00324 {
00325         f.serialVersion(1);
00326         f.serial(_Axis, _NbSamples);
00327         if (f.isReading()) updateSamples();
00328 }

void NL3D::CSpinnerFunctor::setAxis const NLMISC::CVector axis  ) 
 

============================================================================

Definition at line 302 of file ps_plane_basis_maker.cpp.

References _Axis, and updateSamples().

00303 {
00304         _Axis = axis;
00305         updateSamples();
00306 }

const void NL3D::CSpinnerFunctor::setNumSamples uint32  nbSamples  ) 
 

============================================================================

Definition at line 309 of file ps_plane_basis_maker.cpp.

References _NbSamples, nlassert, uint32, and updateSamples().

00310 {
00311         nlassert(nbSamples > 0);
00312         _NbSamples = nbSamples;
00313         updateSamples();
00314 }

void NL3D::CSpinnerFunctor::updateSamples void   )  [protected]
 

============================================================================

Definition at line 331 of file ps_plane_basis_maker.cpp.

References _Axis, _NbSamples, _PBTab, NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), uint32, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

Referenced by setAxis(), and setNumSamples().

00332 {
00333         if (_NbSamples == 0) return;
00334         // compute step between each angle
00335         const float angInc = (float) (2.f * NLMISC::Pi / _NbSamples);
00336         _PBTab.resize(_NbSamples + 1);
00337         NLMISC::CMatrix mat;
00338         CPSUtil::buildSchmidtBasis(_Axis, mat);
00339         NLMISC::CVector I = mat.getI();
00340         NLMISC::CVector J = mat.getJ();
00341         // compute basis for rotation
00342         for (uint32 k = 0; k < _NbSamples; ++k)
00343         {               
00344                 float ca = cosf(k * angInc);
00345                 float sa = sinf(k * angInc);            
00346                 _PBTab[k].X.set(ca * I.x + sa * J.x,
00347                                                 ca * I.y + sa * J.y,
00348                                                 ca * I.z + sa * J.z);
00349                         
00350                 _PBTab[k].Y.set(- sa * I.x + ca * J.x,
00351                                             - sa * I.y + ca * J.y,
00352                                                 - sa * I.z + ca * J.z);
00353         }
00354 }


Field Documentation

NLMISC::CVector NL3D::CSpinnerFunctor::_Axis [protected]
 

Definition at line 205 of file ps_plane_basis_maker.h.

Referenced by setAxis(), and updateSamples().

uint32 NL3D::CSpinnerFunctor::_NbSamples [protected]
 

Definition at line 204 of file ps_plane_basis_maker.h.

Referenced by getNumSamples(), setNumSamples(), and updateSamples().

CPSVector<CPlaneBasis>::V NL3D::CSpinnerFunctor::_PBTab [protected]
 

Definition at line 203 of file ps_plane_basis_maker.h.

Referenced by updateSamples().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:47:22 2004 for NeL by doxygen 1.3.6