Commit da132b67381b7b89d7440cbbb2a60b7c2fd3d8be

Authored by David Mayerich
2 parents 8cd258c6 c11e5e01

Merge branch 'master' of git.stim.ee.uh.edu:codebase/stimlib

Showing 1 changed file with 30 additions and 1 deletions   Show diff stats
stim/visualization/aaboundingbox.h
... ... @@ -63,10 +63,39 @@ public:
63 63 return ss.str();
64 64 }
65 65  
  66 + ///resamples the boundingbox by a factor of N
  67 + std::vector<stim::aaboundingbox<T> >
  68 + resample(unsigned int n)
  69 + {
  70 + stim::vec3<T> step_size = (B-A)/n;
  71 + std::vector<stim::aaboundingbox<T> > boundingboxes(n*n*n);
  72 + for(int x = 0; x < n; x++)
  73 + {
  74 + for(int y = 0; y < n; y++)
  75 + {
  76 + for(int z = 0; z < n; z++)
  77 + {
  78 + ///create the bounding box
  79 + stim::aaboundingbox<T> box;
  80 + box.A[0] = A[0]+step_size[0]*x;
  81 + box.A[1] = A[1]+step_size[1]*y;
  82 + box.A[2] = A[2]+step_size[2]*z;
  83 +
  84 + box.B[0] = A[0]+step_size[0]*(x+1);
  85 + box.B[1] = A[1]+step_size[1]*(y+1);
  86 + box.B[2] = A[2]+step_size[2]*(z+1);
  87 + ///put the new bounding box into the right place
  88 + boundingboxes[x*n*n + y*n + z] = box;
  89 + }
  90 + }
  91 + }
  92 + return boundingboxes;
  93 + }
  94 +
66 95  
67 96 }; //end stim::aabb
68 97  
69 98  
70 99 }; //end namespace stim
71 100  
72   -#endif
73 101 \ No newline at end of file
  102 +#endif
... ...