Commit b2c0d894 authored by Samuel Bastos de Souza Junior's avatar Samuel Bastos de Souza Junior
Browse files

commit da manha humilde

parent 34dda3f3
......@@ -213,8 +213,34 @@ void Octree::createNode(uint32_t key, int level)
bool Octree::divideNode(uint32_t key, int level)
{
if(level >= 3)
return false;
// if(level >= 3)
// return false;
//
// return true;
return true;
for(unsigned int i = level; i >= 0; i--)
{
unsigned int aux = key >> (3*level);
unsigned int octant = aux & 7;
unsigned int x, y, z;
unsigned int dem = pow2(i);
x = (octant & 1) * 32/dem;
y = ((octant & 2) >> 1) * 32/dem;
z = ((octant & 4) >> 2) * 32/dem;
}
}
void Octree::translate(unsigned int octant, int level, int& x, int& y, int& z)
{
}
unsigned int Octree::pow2(unsigned int pot)
{
unsigned int n = 1;
for(unsigned int i = 0; i < pot; i++)
n *= 2;
return n;
}
\ No newline at end of file
......@@ -19,6 +19,8 @@ public:
void generateTree();
void createNode(uint32_t key, int level);
bool divideNode(uint32_t key, int level);
void translate(unsigned int octant, int level, int& x, int& y, int& z);
unsigned int pow2(unsigned int pot);
private:
int _depth;
......
......@@ -6,7 +6,7 @@ int main()
{
IO::Volume volume;
IO::loadRawFile(volume, "cube.raw", 32, 32, 32);
IO::loadRawFile(volume, "/home/samuel/CLionProjects/dual-octree-home/cube.raw", 32, 32, 32);
IO::extrapolateVolume(volume);
Octree octree;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment