Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

fourierBrowser.cpp

Go to the documentation of this file.
00001 #include "fourierBrowser.h"
00002 
00003 template <int SIZE, class TYPE> vu1611_3<SIZE,TYPE>::vu1611_3()
00004 {
00005   m_Map        = NULL;
00006   m_PlanExists = false;
00007 }
00008 
00009 template <int SIZE, class TYPE> vu1611_3<SIZE,TYPE>::~vu1611_3()
00010 {
00011   if (m_PlanExists) {
00012     fftwnd_destroy_plan(m_Plan);
00013     m_PlanExists = false;
00014   }
00015   CHECKNDELETE(m_Map);
00016 }
00017 
00019 template <int SIZE, class TYPE> void vu1611_3<SIZE,TYPE>::render()
00020 {
00021   if (m_Map == NULL || !m_PlanExists)
00022     cerr << "fourierBrowser.render(): not properly initialized" << endl;
00023   else {
00024     *m_Map = *getCurrentView()->getMap();
00025     fftwnd_one(m_Plan, (fftw_complex*)m_Map->getBuffer(), NULL);
00026     *m_Map *= (float)(1/(float)(m_width*m_height)); // normalize 
00027     m_Map->glRender();
00028   }
00029 }
00030 
00032 template <int SIZE, class TYPE> bool vu1611_3<SIZE,TYPE>::read(void)
00033 {
00034   if (!vu1611_1<SIZE,TYPE>::read()) return false;
00035   _initPlanAndMap();
00036   return true;
00037 }
00038 
00039 template <int SIZE, class TYPE> void vu1611_3<SIZE,TYPE>::_initPlanAndMap()
00040 {
00041   cerr << "creating fttw plan...";
00042   if (m_PlanExists) fftwnd_destroy_plan(m_Plan);
00043 
00044   m_Plan = fftw2d_create_plan(m_height, m_width, FFTW_FORWARD,
00045                               FFTW_MEASURE | FFTW_IN_PLACE);
00046   m_PlanExists = true;
00047     
00048   CHECKNDELETE(m_Map);
00049   m_Map = new vuFixelMap<SIZE,TYPE>(m_height, m_width);
00050   cerr << " Done." << endl;
00051 }

Generated on Wed Dec 15 21:20:28 2004 for vuVolume by  doxygen 1.3.9.1