QUAD_POISSON.h

00001 
00002 // File : QUAD_POISSON.h
00004 //
00005 // Copyright 2006
00006 // The University of North Carolina at Chapel Hill
00007 // 
00009 //
00010 // Permission to use, copy, modify, distribute and sell this software and its 
00011 // documentation for any purpose is hereby granted without fee, provided that 
00012 // the above copyright notice appear in all copies and that both that copyright 
00013 // notice and this permission notice appear in supporting documentation. 
00014 // Binaries may be compiled with this software without any royalties or 
00015 // restrictions. 
00016 //
00017 // The University of North Carolina at Chapel Hill makes no representations 
00018 // about the suitability of this software for any purpose. It is provided 
00019 // "as is" without express or implied warranty.
00020 //
00021 
00022 #ifndef QUAD_POISSON_H
00023 #define QUAD_POISSON_H
00024 
00025 #define USINGGLUT
00026 
00027 #ifdef USINGGLUT
00028 #include <gl/glut.h>
00029 #endif
00030 #include <cstdlib>
00031 #include "CELL.h"
00032 #include <list>
00033 #include "CG_SOLVER.h"
00034 #include "CG_SOLVER_SSE.h"
00035 #include "BlueNoise/BLUE_NOISE.h"
00036 
00037 #include <iostream>
00038 
00039 using namespace std;
00040 
00044 class QUAD_POISSON  
00045 {
00046 public:
00052         QUAD_POISSON(int xRes, 
00053                int yRes,
00054                int iterations = 10);
00055   
00057         virtual ~QUAD_POISSON();
00058  
00059 #ifdef USINGGLUT  
00063   void draw(CELL* cell = NULL);
00064 
00071   void drawCell(CELL* cell, 
00072                 float r = 1.0f, 
00073                 float g = 0.0f, 
00074                 float b = 0.0f);
00075 #endif
00076 
00078   int solve();  
00079  
00084   CELL* insert(float xPos, float yPos);
00085 
00090   CELL* insert(int xPos, int yPos) { 
00091     return insert((float)xPos / _maxRes, (float)yPos / _maxRes);
00092   };
00093   
00096   void getAllLeaves(list<CELL*>& leaves, CELL* currentCell = NULL);
00097   
00100   list<CELL*>& getSmallestLeaves() { return _smallestLeaves; };
00101 
00103   int& maxRes() { return _maxRes; }
00104 
00106   int& maxDepth() { return _maxDepth; };
00107   
00108 private:
00110   CELL* _root;
00111 
00113   int _maxRes;
00114 
00116   int _maxDepth;
00117   
00119   list<CELL*> _emptyLeaves;
00120 
00122   list<CELL*> _smallestLeaves;
00123   
00125   CG_SOLVER* _solver;
00126   
00128   void balance();
00129 
00131   void getEmptyLeaves(list<CELL*>& leaves, CELL* currentCell = NULL);
00132   
00134   void buildNeighbors();
00135 
00137   void deleteGhosts(CELL* currentCell = NULL);
00138 
00140   BLUE_NOISE* _noiseFunc;
00141 
00143   bool* _noise;
00144 
00146   void setNoise(CELL* cell);
00147 };
00148 
00149 #endif

Generated on Wed Oct 25 03:19:42 2006 for Lumos by  doxygen 1.4.6