removed internal storage of regions and access function

This commit is contained in:
Sven Oesau 2023-03-20 10:49:54 +01:00
parent 41c9f6de7e
commit 4f2758777d
1 changed files with 4 additions and 31 deletions

View File

@ -360,7 +360,6 @@ namespace internal {
PrimitiveAndRegionOutputIterator detect(PrimitiveAndRegionOutputIterator region_out = PrimitiveAndRegionOutputIterator()) {
// clear(); TODO: this is not valid to comment this clear()
m_visited_map.clear(); // tmp replacement for the line above
m_regions.clear();
Region region;
m_nb_regions = 0;
@ -391,40 +390,30 @@ namespace internal {
/*!
\brief runs the region growing algorithm
*/
void detect() {
// clear(); TODO: this is not valid to comment this clear()
m_visited_map.clear(); // tmp replacement for the line above
m_regions.clear();
m_primitives.clear();
Region region;
m_nb_regions = 0;
m_regions.push_back(std::vector<typename Region_type::Item>());
// Grow regions.
for (auto it = m_seed_range.begin(); it != m_seed_range.end(); it++) {
const Item seed = *it;
// Try to grow a new region from the index of the seed item.
if (!get(m_visited, seed)) {
const bool is_success = propagate(seed, m_regions.back());
const bool is_success = propagate(seed, region);
// Check global conditions.
if (!is_success || !m_region_type.is_valid_region(m_regions.back())) {
revert(m_regions.back());
if (!is_success || !m_region_type.is_valid_region(region)) {
revert(region);
}
else {
m_primitives.push_back(m_region_type.primitive());
fill_region_map(m_nb_regions++, m_regions.back());
m_regions.push_back(std::vector<typename Region_type::Item>());
fill_region_map(m_nb_regions++, region);
}
}
}
// Remove the last empty region entry.
m_regions.pop_back();
}
/*!
@ -432,24 +421,10 @@ namespace internal {
\return Property map that maps each iterator of the input range to a region index.
*/
const Region_map& region_map() {
return m_region_map;
}
/*!
\brief provides the `Region` vector for the region with index idx.
\return `Region` vector of the detected region with index idx.
\pre idx < number_of_regions_detected
*/
const Region& region(std::size_t idx) {
CGAL_assertion(m_regions.size() > idx);
return m_regions[idx];
}
/// @}
/// \name Unassigned Items
@ -525,8 +500,6 @@ namespace internal {
Region_type& m_region_type;
Region_map m_region_map;
std::vector<std::vector<typename Region_type::Item> > m_regions;
std::vector<typename Region_type::Primitive> m_primitives;
std::vector<Item> m_seed_range;
std::size_t m_nb_regions = 0;