Corrected small clang typename issues
This commit is contained in:
parent
28e1d4e21a
commit
d520fe2f0e
|
@ -464,7 +464,7 @@ OBJECT_RETRIEVER:
|
||||||
std::vector< Neighbour > neighbors;
|
std::vector< Neighbour > neighbors;
|
||||||
|
|
||||||
IncrementMark();
|
IncrementMark();
|
||||||
ContainedLeaves(query_bb, leaves, TemplatedOctree::Root(), TemplatedOctree::boundingBox);
|
TemplatedOctree::ContainedLeaves(query_bb, leaves, TemplatedOctree::Root(), TemplatedOctree::boundingBox);
|
||||||
|
|
||||||
int leaves_count = int(leaves.size());
|
int leaves_count = int(leaves.size());
|
||||||
if (leaves_count==0)
|
if (leaves_count==0)
|
||||||
|
|
|
@ -796,7 +796,7 @@ namespace vcg
|
||||||
for (int j=0; j<m_EntryPerSide; j++)
|
for (int j=0; j<m_EntryPerSide; j++)
|
||||||
for (int k=0; k<m_EntryPerSide; k++)
|
for (int k=0; k<m_EntryPerSide; k++)
|
||||||
{
|
{
|
||||||
std::vector< typedef UniformGrid::CellCoordinate > *preimage = &m_H1PreImage[i][j][k];
|
std::vector< typename UniformGrid::CellCoordinate > *preimage = &m_H1PreImage[i][j][k];
|
||||||
if (preimage->size()>0)
|
if (preimage->size()>0)
|
||||||
pre_image.push_back( PreImage(typename UniformGrid::CellCoordinate(i, j, k), preimage) );
|
pre_image.push_back( PreImage(typename UniformGrid::CellCoordinate(i, j, k), preimage) );
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ namespace vcg
|
||||||
(
|
(
|
||||||
OBJECT_POINT_DISTANCE_FUNCTOR & distance_functor,
|
OBJECT_POINT_DISTANCE_FUNCTOR & distance_functor,
|
||||||
OBJECT_MARKER & marker,
|
OBJECT_MARKER & marker,
|
||||||
const CoordType & sphere_center,
|
const CoordinateType & sphere_center,
|
||||||
const ScalarType & sphere_radius,
|
const ScalarType & sphere_radius,
|
||||||
OBJECT_POINTER_CONTAINER & objects,
|
OBJECT_POINTER_CONTAINER & objects,
|
||||||
DISTANCE_CONTAINER & distances,
|
DISTANCE_CONTAINER & distances,
|
||||||
|
@ -1215,8 +1215,8 @@ namespace vcg
|
||||||
contained_objects.push_back(tmp);
|
contained_objects.push_back(tmp);
|
||||||
|
|
||||||
std::vector< Neighbor > results;
|
std::vector< Neighbor > results;
|
||||||
for (std::vector< std::vector< ObjectPointer >* >::iterator iVec=contained_objects.begin(), eVec=contained_objects.end(); iVec!=eVec; iVec++)
|
for (typename std::vector< typename std::vector< ObjectPointer >* >::iterator iVec=contained_objects.begin(), eVec=contained_objects.end(); iVec!=eVec; iVec++)
|
||||||
for (std::vector< ObjectPointer >::iterator iObj=(*iVec)->begin(), eObj=(*iVec)->end(); iObj!=eObj; iObj++ )
|
for (typename std::vector< ObjectPointer >::iterator iObj=(*iVec)->begin(), eObj=(*iVec)->end(); iObj!=eObj; iObj++ )
|
||||||
{
|
{
|
||||||
int r = int(results.size());
|
int r = int(results.size());
|
||||||
results.push_back(Neighbor());
|
results.push_back(Neighbor());
|
||||||
|
@ -1256,7 +1256,7 @@ namespace vcg
|
||||||
if (!m_Bitmap[ug_index])
|
if (!m_Bitmap[ug_index])
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
HashTable::EntryCoordinate ht_index = PerfectHashFunction(ug_index);
|
typename HashTable::EntryCoordinate ht_index = PerfectHashFunction(ug_index);
|
||||||
std::vector< ObjectPointer >* result = m_HashTable[ht_index];
|
std::vector< ObjectPointer >* result = m_HashTable[ht_index];
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1267,7 +1267,7 @@ namespace vcg
|
||||||
if(!m_Bitmap[query])
|
if(!m_Bitmap[query])
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
HashTable::EntryCoordinate ht_index = PerfectHashFunction(query);
|
typename HashTable::EntryCoordinate ht_index = PerfectHashFunction(query);
|
||||||
std::vector< ObjectPointer >* result = m_HashTable[ht_index]->domain_data;
|
std::vector< ObjectPointer >* result = m_HashTable[ht_index]->domain_data;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1282,7 @@ namespace vcg
|
||||||
typename HashTable::EntryCoordinate PerfectHashFunction(const typename UniformGrid::CellCoordinate &query)
|
typename HashTable::EntryCoordinate PerfectHashFunction(const typename UniformGrid::CellCoordinate &query)
|
||||||
{
|
{
|
||||||
typename HashTable::EntryCoordinate result;
|
typename HashTable::EntryCoordinate result;
|
||||||
OffsetTable::OffsetPointer offset = m_OffsetTable[ m_OffsetTable.DomainToOffsetTable(query) ];
|
typename OffsetTable::OffsetPointer offset = m_OffsetTable[ m_OffsetTable.DomainToOffsetTable(query) ];
|
||||||
result = m_HashTable.DomainToHashTable( Shift(query, *offset) );
|
result = m_HashTable.DomainToHashTable( Shift(query, *offset) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1296,7 @@ namespace vcg
|
||||||
*/
|
*/
|
||||||
typename HashTable::EntryCoordinate Shift(const vcg::Point3i &entry, const typename OffsetTable::Offset &offset)
|
typename HashTable::EntryCoordinate Shift(const vcg::Point3i &entry, const typename OffsetTable::Offset &offset)
|
||||||
{
|
{
|
||||||
HashTable::EntryCoordinate result;
|
typename HashTable::EntryCoordinate result;
|
||||||
result.X() = entry.X() + int(offset.X());
|
result.X() = entry.X() + int(offset.X());
|
||||||
result.Y() = entry.Y() + int(offset.Y());
|
result.Y() = entry.Y() + int(offset.Y());
|
||||||
result.Z() = entry.Z() + int(offset.Z());
|
result.Z() = entry.Z() + int(offset.Z());
|
||||||
|
@ -1376,7 +1376,7 @@ namespace vcg
|
||||||
*/
|
*/
|
||||||
void PerformFastConstruction(const int number_of_filled_cells, vcg::CallBackPos *callback)
|
void PerformFastConstruction(const int number_of_filled_cells, vcg::CallBackPos *callback)
|
||||||
{
|
{
|
||||||
int offset_table_size = (int) ceilf(powf(m_SIGMA*float(number_of_filled_cells), 1.0f/float(m_DIMENSION)));
|
int offset_table_size = (int) ceilf(powf(m_SIGMA()*float(number_of_filled_cells), 1.0f/float(m_DIMENSION())));
|
||||||
int hash_table_size = m_HashTable.GetSize();
|
int hash_table_size = m_HashTable.GetSize();
|
||||||
int failed_construction_count = 0;
|
int failed_construction_count = 0;
|
||||||
do
|
do
|
||||||
|
@ -1400,7 +1400,7 @@ namespace vcg
|
||||||
int half_hash_table_size = int(float(hash_table_size)/2.0f);
|
int half_hash_table_size = int(float(hash_table_size)/2.0f);
|
||||||
|
|
||||||
// According to the original article, a maximum number of trials are to be made in order to select the optimal (i.e. minimal) offset table size
|
// According to the original article, a maximum number of trials are to be made in order to select the optimal (i.e. minimal) offset table size
|
||||||
for (int t=0; t<m_MAX_TRIALS_IN_COMPACT_CONSTRUCTION; t++)
|
for (int t=0; t<m_MAX_TRIALS_IN_COMPACT_CONSTRUCTION(); t++)
|
||||||
{
|
{
|
||||||
int lower_bound = GetUnefectiveOffsetTableSize(hash_table_size, int(double(rand())/double(RAND_MAX)*half_hash_table_size + 1) );
|
int lower_bound = GetUnefectiveOffsetTableSize(hash_table_size, int(double(rand())/double(RAND_MAX)*half_hash_table_size + 1) );
|
||||||
int upper_bound = GetUnefectiveOffsetTableSize(hash_table_size, int(((double) rand() / (double) RAND_MAX) * hash_table_size + half_hash_table_size));
|
int upper_bound = GetUnefectiveOffsetTableSize(hash_table_size, int(((double) rand() / (double) RAND_MAX) * hash_table_size + half_hash_table_size));
|
||||||
|
@ -1421,7 +1421,7 @@ namespace vcg
|
||||||
if ( OffsetTableConstructionSucceded((last_tried_size=candidate_offset_table_size), callback) )
|
if ( OffsetTableConstructionSucceded((last_tried_size=candidate_offset_table_size), callback) )
|
||||||
{
|
{
|
||||||
upper_bound = candidate_offset_table_size;
|
upper_bound = candidate_offset_table_size;
|
||||||
min_successfully_dimension = vcg::math::Min(candidate_offset_table_size, min_successfully_dimension);
|
min_successfully_dimension = std::min(candidate_offset_table_size, min_successfully_dimension);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lower_bound = candidate_offset_table_size;
|
lower_bound = candidate_offset_table_size;
|
||||||
|
@ -1458,7 +1458,7 @@ namespace vcg
|
||||||
m_OffsetTable.Allocate(offset_table_size); // Create the Offset table
|
m_OffsetTable.Allocate(offset_table_size); // Create the Offset table
|
||||||
m_OffsetTable.BuildH1PreImage(m_UniformGrid.Begin(), m_UniformGrid.End()); // Build the f0 pre-image
|
m_OffsetTable.BuildH1PreImage(m_UniformGrid.Begin(), m_UniformGrid.End()); // Build the f0 pre-image
|
||||||
|
|
||||||
std::list< OffsetTable::PreImage > preimage_slots;
|
std::list< typename OffsetTable::PreImage > preimage_slots;
|
||||||
m_OffsetTable.GetPreImageSortedPerCardinality(preimage_slots);
|
m_OffsetTable.GetPreImageSortedPerCardinality(preimage_slots);
|
||||||
|
|
||||||
char msg[128];
|
char msg[128];
|
||||||
|
@ -1467,7 +1467,7 @@ namespace vcg
|
||||||
int number_of_slots = int(preimage_slots.size());
|
int number_of_slots = int(preimage_slots.size());
|
||||||
int perc = 0;
|
int perc = 0;
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
for (std::list< OffsetTable::PreImage >::iterator iPreImage=preimage_slots.begin(), ePreImage=preimage_slots.end(); iPreImage!=ePreImage; iPreImage++, iter++)
|
for (typename std::list< typename OffsetTable::PreImage >::iterator iPreImage=preimage_slots.begin(), ePreImage=preimage_slots.end(); iPreImage!=ePreImage; iPreImage++, iter++)
|
||||||
{
|
{
|
||||||
if (callback!=NULL && iter%step==0 && (perc=iter*100/number_of_slots)<100) (*callback)(perc, msg);
|
if (callback!=NULL && iter%step==0 && (perc=iter*100/number_of_slots)<100) (*callback)(perc, msg);
|
||||||
|
|
||||||
|
@ -1477,7 +1477,7 @@ namespace vcg
|
||||||
// Heuristic #1: try to set the offset value to one stored in a neighboring entry of the offset table
|
// Heuristic #1: try to set the offset value to one stored in a neighboring entry of the offset table
|
||||||
std::vector< typename OffsetTable::Offset > consistent_offsets;
|
std::vector< typename OffsetTable::Offset > consistent_offsets;
|
||||||
m_OffsetTable.SuggestConsistentOffsets( (*iPreImage).entry_index, consistent_offsets);
|
m_OffsetTable.SuggestConsistentOffsets( (*iPreImage).entry_index, consistent_offsets);
|
||||||
for (std::vector< typename OffsetTable::Offset >::iterator iOffset=consistent_offsets.begin(), eOffset=consistent_offsets.end(); iOffset!=eOffset && !found_valid_offset; iOffset++)
|
for (typename std::vector< typename OffsetTable::Offset >::iterator iOffset=consistent_offsets.begin(), eOffset=consistent_offsets.end(); iOffset!=eOffset && !found_valid_offset; iOffset++)
|
||||||
if (IsAValidOffset(iPreImage->pre_image, *iOffset))
|
if (IsAValidOffset(iPreImage->pre_image, *iOffset))
|
||||||
{
|
{
|
||||||
found_valid_offset = true;
|
found_valid_offset = true;
|
||||||
|
@ -1489,11 +1489,11 @@ namespace vcg
|
||||||
if (!found_valid_offset)
|
if (!found_valid_offset)
|
||||||
{
|
{
|
||||||
std::vector< typename UniformGrid::CellCoordinate > *pre_image = (*iPreImage).pre_image;
|
std::vector< typename UniformGrid::CellCoordinate > *pre_image = (*iPreImage).pre_image;
|
||||||
for (std::vector< typename UniformGrid::CellCoordinate >::iterator iPreImage=pre_image->begin(), ePreImage=pre_image->end(); iPreImage!=ePreImage && !found_valid_offset; iPreImage++)
|
for (typename std::vector< typename UniformGrid::CellCoordinate >::iterator iPreImage=pre_image->begin(), ePreImage=pre_image->end(); iPreImage!=ePreImage && !found_valid_offset; iPreImage++)
|
||||||
for (NeighboringEntryIterator iUGNeighbourhood=m_UniformGrid.GetNeighboringEntryIterator(*iPreImage); iUGNeighbourhood<6 && !found_valid_offset; iUGNeighbourhood++ )
|
for (NeighboringEntryIterator iUGNeighbourhood=m_UniformGrid.GetNeighboringEntryIterator(*iPreImage); iUGNeighbourhood<6 && !found_valid_offset; iUGNeighbourhood++ )
|
||||||
if (!m_OffsetTable.IsFree( m_OffsetTable.DomainToOffsetTable( *iUGNeighbourhood ) ))
|
if (!m_OffsetTable.IsFree( m_OffsetTable.DomainToOffsetTable( *iUGNeighbourhood ) ))
|
||||||
{
|
{
|
||||||
HashTable::EntryCoordinate ht_entry = PerfectHashFunction(*iUGNeighbourhood);
|
typename HashTable::EntryCoordinate ht_entry = PerfectHashFunction(*iUGNeighbourhood);
|
||||||
for (NeighboringEntryIterator iHTNeighbourhood=m_HashTable.GetNeighborintEntryIterator(ht_entry); iHTNeighbourhood<6 && !found_valid_offset; iHTNeighbourhood++)
|
for (NeighboringEntryIterator iHTNeighbourhood=m_HashTable.GetNeighborintEntryIterator(ht_entry); iHTNeighbourhood<6 && !found_valid_offset; iHTNeighbourhood++)
|
||||||
if (m_HashTable.IsFree(*iHTNeighbourhood))
|
if (m_HashTable.IsFree(*iHTNeighbourhood))
|
||||||
{
|
{
|
||||||
|
@ -1508,9 +1508,9 @@ namespace vcg
|
||||||
if (!found_valid_offset)
|
if (!found_valid_offset)
|
||||||
{
|
{
|
||||||
// At the beginning, the offset can be found via random searches
|
// At the beginning, the offset can be found via random searches
|
||||||
for (int i=0; i<m_MAX_NUM_OF_RANDOM_GENERATED_OFFSET && !found_valid_offset; i++)
|
for (int i=0; i<m_MAX_NUM_OF_RANDOM_GENERATED_OFFSET() && !found_valid_offset; i++)
|
||||||
{
|
{
|
||||||
HashTable::EntryCoordinate base_entry = (*iPreImage).pre_image->at(0);
|
typename HashTable::EntryCoordinate base_entry = (*iPreImage).pre_image->at(0);
|
||||||
do
|
do
|
||||||
m_OffsetTable.GetRandomOffset(candidate_offset);
|
m_OffsetTable.GetRandomOffset(candidate_offset);
|
||||||
while (!m_HashTable.IsFree( m_HashTable.DomainToHashTable( Shift(base_entry, candidate_offset) ) ));
|
while (!m_HashTable.IsFree( m_HashTable.DomainToHashTable( Shift(base_entry, candidate_offset) ) ));
|
||||||
|
@ -1521,11 +1521,11 @@ namespace vcg
|
||||||
|
|
||||||
// The chance to find a valid offset table via random searches decreases toward the end of the offset table construction:
|
// The chance to find a valid offset table via random searches decreases toward the end of the offset table construction:
|
||||||
// So a exhaustive search over all the free hash table entries is performed.
|
// So a exhaustive search over all the free hash table entries is performed.
|
||||||
for (std::list< HashTable::EntryCoordinate >::const_iterator iFreeCell=m_HashTable.GetFreeEntryList()->begin(), eFreeCell=m_HashTable.GetFreeEntryList()->end(); iFreeCell!=eFreeCell && !found_valid_offset; iFreeCell++)
|
for (typename std::list< typename HashTable::EntryCoordinate >::const_iterator iFreeCell=m_HashTable.GetFreeEntryList()->begin(), eFreeCell=m_HashTable.GetFreeEntryList()->end(); iFreeCell!=eFreeCell && !found_valid_offset; iFreeCell++)
|
||||||
{
|
{
|
||||||
UniformGrid::CellCoordinate domain_entry = (*iPreImage).pre_image->at(0);
|
typename UniformGrid::CellCoordinate domain_entry = (*iPreImage).pre_image->at(0);
|
||||||
OffsetTable::EntryCoordinate offset_entry = m_OffsetTable.DomainToOffsetTable(domain_entry);
|
typename OffsetTable::EntryCoordinate offset_entry = m_OffsetTable.DomainToOffsetTable(domain_entry);
|
||||||
HashTable::EntryCoordinate hashtable_entry = m_HashTable.DomainToHashTable(domain_entry);
|
typename HashTable::EntryCoordinate hashtable_entry = m_HashTable.DomainToHashTable(domain_entry);
|
||||||
candidate_offset.Import(*iFreeCell - hashtable_entry);
|
candidate_offset.Import(*iFreeCell - hashtable_entry);
|
||||||
|
|
||||||
if ( IsAValidOffset(iPreImage->pre_image, candidate_offset) )
|
if ( IsAValidOffset(iPreImage->pre_image, candidate_offset) )
|
||||||
|
@ -1540,7 +1540,7 @@ namespace vcg
|
||||||
m_OffsetTable.SetOffset( (*iPreImage->pre_image).at(0), candidate_offset);
|
m_OffsetTable.SetOffset( (*iPreImage->pre_image).at(0), candidate_offset);
|
||||||
for (int c=0, pre_image_cardinality = iPreImage->cardinality; c<pre_image_cardinality; c++)
|
for (int c=0, pre_image_cardinality = iPreImage->cardinality; c<pre_image_cardinality; c++)
|
||||||
{
|
{
|
||||||
HashTable::EntryCoordinate ht_entry = PerfectHashFunction( (*iPreImage->pre_image).at(c));
|
typename HashTable::EntryCoordinate ht_entry = PerfectHashFunction( (*iPreImage->pre_image).at(c));
|
||||||
std::vector< ObjectPointer > *domain_data = m_UniformGrid[ (*iPreImage->pre_image).at(c) ];
|
std::vector< ObjectPointer > *domain_data = m_UniformGrid[ (*iPreImage->pre_image).at(c) ];
|
||||||
m_HashTable.SetEntry(ht_entry, domain_data /*, (*iPreImage->pre_image).at(c)*/); // might be useful for encoding sparsity
|
m_HashTable.SetEntry(ht_entry, domain_data /*, (*iPreImage->pre_image).at(c)*/); // might be useful for encoding sparsity
|
||||||
m_Bitmap.SetFlag((*iPreImage->pre_image).at(c));
|
m_Bitmap.SetFlag((*iPreImage->pre_image).at(c));
|
||||||
|
@ -1570,30 +1570,16 @@ namespace vcg
|
||||||
HashTable m_HashTable; /*!< The hash table that will substitute the uniform grid. */
|
HashTable m_HashTable; /*!< The hash table that will substitute the uniform grid. */
|
||||||
BinaryImage m_Bitmap;
|
BinaryImage m_Bitmap;
|
||||||
|
|
||||||
const static float m_BOUNDING_BOX_EXPANSION_FACTOR;
|
const static float m_BOUNDING_BOX_EXPANSION_FACTOR() { return SCALAR_TYPE(0.035); }
|
||||||
const static float m_SIGMA;
|
const static float m_SIGMA() {return SCALAR_TYPE(1.0f/(2.0f*SCALAR_TYPE(m_DIMENSION)));}
|
||||||
const static int m_MAX_TRIALS_IN_COMPACT_CONSTRUCTION;
|
const static int m_MAX_TRIALS_IN_COMPACT_CONSTRUCTION () { return 5; }
|
||||||
const static int m_MAX_NUM_OF_RANDOM_GENERATED_OFFSET;
|
const static int m_MAX_NUM_OF_RANDOM_GENERATED_OFFSET() {return 32;}
|
||||||
const static int m_DIMENSION;
|
const static int m_DIMENSION() {return 3;}
|
||||||
}; //end of class PerfectSpatialHashing
|
}; //end of class PerfectSpatialHashing
|
||||||
|
|
||||||
/*! @} */
|
/*! @} */
|
||||||
//end of Doxygen documentation
|
//end of Doxygen documentation
|
||||||
}//end of namespace vcg
|
}//end of namespace vcg
|
||||||
|
|
||||||
template < class OBJECT_TYPE, class SCALAR_TYPE >
|
|
||||||
const int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::m_MAX_NUM_OF_RANDOM_GENERATED_OFFSET = 32;
|
|
||||||
|
|
||||||
template < class OBJECT_TYPE, class SCALAR_TYPE >
|
|
||||||
const int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::m_MAX_TRIALS_IN_COMPACT_CONSTRUCTION = 5;
|
|
||||||
|
|
||||||
template < class OBJECT_TYPE, class SCALAR_TYPE >
|
|
||||||
const int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::m_DIMENSION = 3;
|
|
||||||
|
|
||||||
template < class OBJECT_TYPE, class SCALAR_TYPE >
|
|
||||||
const SCALAR_TYPE vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::m_BOUNDING_BOX_EXPANSION_FACTOR = SCALAR_TYPE(0.035);
|
|
||||||
|
|
||||||
template < class OBJECT_TYPE, class SCALAR_TYPE >
|
|
||||||
const SCALAR_TYPE vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::m_SIGMA = SCALAR_TYPE(1.0f/(2.0f*SCALAR_TYPE(m_DIMENSION)));
|
|
||||||
|
|
||||||
#endif //VCG_SPACE_INDEX_PERFECT_SPATIAL_HASHING_H
|
#endif //VCG_SPACE_INDEX_PERFECT_SPATIAL_HASHING_H
|
Loading…
Reference in New Issue