diff --git a/stim/visualization/aaboundingbox.h b/stim/visualization/aaboundingbox.h index c4afbac..554c140 100644 --- a/stim/visualization/aaboundingbox.h +++ b/stim/visualization/aaboundingbox.h @@ -63,10 +63,39 @@ public: return ss.str(); } + ///resamples the boundingbox by a factor of N + std::vector > + resample(unsigned int n) + { + stim::vec3 step_size = (B-A)/n; + std::vector > boundingboxes(n*n*n); + for(int x = 0; x < n; x++) + { + for(int y = 0; y < n; y++) + { + for(int z = 0; z < n; z++) + { + ///create the bounding box + stim::aaboundingbox box; + box.A[0] = A[0]+step_size[0]*x; + box.A[1] = A[1]+step_size[1]*y; + box.A[2] = A[2]+step_size[2]*z; + + box.B[0] = A[0]+step_size[0]*(x+1); + box.B[1] = A[1]+step_size[1]*(y+1); + box.B[2] = A[2]+step_size[2]*(z+1); + ///put the new bounding box into the right place + boundingboxes[x*n*n + y*n + z] = box; + } + } + } + return boundingboxes; + } + }; //end stim::aabb }; //end namespace stim -#endif \ No newline at end of file +#endif -- libgit2 0.21.4