src/rcrt/gi/PKDNode.h

Go to the documentation of this file.
00001 #ifndef PKDNODE_H_
00002 #define PKDNODE_H_
00003 
00004 #include "../primitives/AABB.h"
00005 #include "Photon.h"
00006 #include <list>
00007 #include <vector>
00008 
00009 namespace rcrt{
00010 
00011 struct PKDSplitPlane{
00012         PKDSplitPlane(Photon* phot, Axis ax):p(phot),axis(ax)
00013         {}
00014         Photon* p;
00015         const Axis axis;
00016 };
00017 
00018 struct PKDSearchP{
00019         PKDSearchP(Photon* phot, const float& d):p(phot),distSqr(d)
00020         {}
00021         Photon* p;
00022         float distSqr;
00023         
00024         bool operator<(const PKDSearchP& pks) const
00025         {
00026                 return distSqr < pks.distSqr;
00027         }
00028 };
00029 
00030 class PKDNode
00031 {
00032 private:
00033         PKDNode* children[2];
00034         Photon* photon;
00035         Axis splitAxis;
00036         
00037 public:
00038         PKDNode(std::list<PKDSplitPlane*>* splits, const float& maxRadius, const AABB& bbox);
00039         ~PKDNode();
00040         
00041         bool isLeaf() const;
00042         
00043         void getKNearest(std::vector<PKDSearchP>* result, const unsigned int& k,
00044                                 const Point3D& pos, const Vec3D& normal,
00045                                 const float& maxRadius,const float& flat) const;
00046         
00047 };
00048 
00049 }//namespace
00050 
00051 #endif /*PKDNODE_H_*/

Generated on Thu Jan 31 19:26:19 2008 for RenderingCompetitionRayTracer by  doxygen 1.5.3