34 const typename Grid::Border &
border,
35 std::vector<int> &tags)
37 std::vector<int> local_tags(grid.CellSize(), -1);
39 int no_cells = grid.CellSize();
41 int progress_size = no_cells / 100;
42 if (progress_size == 0)
45 vector<int> unclassified_v(no_cells);
46 for (
int i = 0; i < no_cells; ++i)
48 unclassified_v[i] = i;
50 std::set<int> unclassified(unclassified_v.begin(), unclassified_v.end());
52 while (!unclassified.empty())
54 int start = *(unclassified.begin());
55 local_tags[
start] = tag_label;
56 unclassified.erase(unclassified.begin());
59 while (!active.empty())
63 set<int>::iterator active_it = active.begin();
64 set<int>::iterator active_it_end = active.end();
66 for (; active_it != active_it_end; ++active_it)
68 std::vector<int> neighbourLabels;
70 typename Grid::NeighbourhoodContainer nc;
71 grid.GetEdgeNeighbours(*active_it, nc);
73 typename Grid::NeighbourhoodContainer::iterator ncit = nc.begin();
74 typename Grid::NeighbourhoodContainer::iterator ncend = nc.end();
75 for (; ncit != ncend; ++ncit)
78 if (local_tags[ncit->CellLabel()] != -1)
83 if (border.IsIn((*ncit)))
88 new_active.insert(ncit->CellLabel());
93 new_active.swap(active);
94 active_it = active.begin();
95 active_it_end = active.end();
96 for (; active_it != active_it_end; ++active_it)
98 local_tags[*active_it] = tag_label;
99 unclassified.erase(*active_it);
104 local_tags.swap(tags);
Definition: coCuttingSurface.h:51
void RainAlgorithm(const Grid &grid, const typename Grid::Border &border, std::vector< int > &tags)
Definition: RainAlgorithm.h:33
GLuint start
Definition: khronos-glext.h:6343