restore default voxelsz and add option to change voxelsz

This commit is contained in:
Xuchen Han
2019-08-21 22:29:53 -07:00
parent 4e1c1a30a7
commit 75d0cfaf69
2 changed files with 10 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ public:
m_sbi.m_broadphase = pairCache; m_sbi.m_broadphase = pairCache;
m_sbi.m_dispatcher = dispatcher; m_sbi.m_dispatcher = dispatcher;
m_sbi.m_sparsesdf.Initialize(); m_sbi.m_sparsesdf.Initialize();
m_sbi.m_sparsesdf.setDefaultVoxelsz(0.0025);
m_sbi.m_sparsesdf.Reset(); m_sbi.m_sparsesdf.Reset();
m_sbi.air_density = (btScalar)1.2; m_sbi.air_density = (btScalar)1.2;

View File

@@ -70,6 +70,7 @@ struct btSparseSdf
btAlignedObjectArray<Cell*> cells; btAlignedObjectArray<Cell*> cells;
btScalar voxelsz; btScalar voxelsz;
btScalar m_defaultVoxelsz;
int puid; int puid;
int ncells; int ncells;
int m_clampCells; int m_clampCells;
@@ -87,9 +88,16 @@ struct btSparseSdf
//if this limit is reached, the SDF is reset (at the cost of some performance during the reset) //if this limit is reached, the SDF is reset (at the cost of some performance during the reset)
m_clampCells = clampCells; m_clampCells = clampCells;
cells.resize(hashsize, 0); cells.resize(hashsize, 0);
m_defaultVoxelsz = 0.25;
Reset(); Reset();
} }
// //
void setDefaultVoxelsz(btScalar sz)
{
m_defaultVoxelsz = sz;
}
void Reset() void Reset()
{ {
for (int i = 0, ni = cells.size(); i < ni; ++i) for (int i = 0, ni = cells.size(); i < ni; ++i)
@@ -103,7 +111,7 @@ struct btSparseSdf
pc = pn; pc = pn;
} }
} }
voxelsz = 0.25; voxelsz = m_defaultVoxelsz;
puid = 0; puid = 0;
ncells = 0; ncells = 0;
nprobes = 1; nprobes = 1;