I am trying to implement kdtree using the pbrt source code to find the nearest points n . I have an array of points distributed over three-dimensional space, and I need to calculate the number of points lying at a given distance from the control point. So can someone guide me on how I can proceed? Basically, I use the same search process (PhotonProcess) as the integrators /photonmap.cpp. But for some reason I get strange results. Here is a small part of the code I'm using.
const uint32_t nAbsorptionPhotons = 10; //photons to be found PhotonProcess proc(nAbsorptionPhotons,arena.Alloc<ClosePhoton>(nAbsorptionPhotons)); float searchDist = 0.f; Photon p; ppx = 50; //just a reference point set arbitrarily to 50 ppy = 50; ppz = 50; searchDist = 0; while (proc.nFound < nAbsorptionPhotons) { float md2 = searchDist; AbsorptionMap->Lookup(pp, proc, md2); searchDist += 1.f; } printf("SearchDistance is %f \n", searchDist);
I do not get the expected value of searchdist. Any hints of ideas or suggestions are welcome.
source share