00001 #ifndef PHOTONKDTREE_H_ 00002 #define PHOTONKDTREE_H_ 00003 00004 #include "../primitives/AABB.h" 00005 #include "PKDNode.h" 00006 00007 namespace rcrt 00008 { 00009 00010 class PhotonKDTree 00011 { 00012 private: 00013 std::vector<Photon*>* photons; 00014 float maxSqrRadius; 00015 PKDNode* root; 00016 bool empty; 00017 00018 static bool splitPlaneCompare(PKDSplitPlane* a, PKDSplitPlane* b); 00019 00020 public: 00021 PhotonKDTree(const float& maxSqrRadius); 00022 virtual ~PhotonKDTree(); 00023 00024 void buildTree(std::vector<Photon*>* phots); 00025 00026 void getKNearest(std::vector<PKDSearchP>* result, const unsigned int& k, 00027 const Point3D& pos, const Vec3D& normal, const float& radiusSqr, 00028 const float& flat) const; 00029 }; 00030 00031 } 00032 00033 #endif /*PHOTONKDTREE_H_*/