Build a list of partitions. The partition is the size of each block in the x and y directions in number of points.
| 157 | // Build a list of partitions. The partition is the size of each block in |
| 158 | // the x and y directions in number of points. |
| 159 | void ChipperFilter::partition(point_count_t size) |
| 160 | { |
| 161 | size_t num_partitions; |
| 162 | |
| 163 | num_partitions = size / m_threshold; |
| 164 | if (size % m_threshold) |
| 165 | num_partitions++; |
| 166 | |
| 167 | // This is a standard statistics cumulate and round. It distributes |
| 168 | // the points into partitions such the "extra" points are reasonably |
| 169 | // distributed among the partitions. |
| 170 | double total(0.0); |
| 171 | double partition_size = static_cast<double>(size) / num_partitions; |
| 172 | m_partitions.push_back(0); |
| 173 | for (size_t i = 0; i < num_partitions; ++i) |
| 174 | { |
| 175 | total += partition_size; |
| 176 | size_t itotal = lround(total); |
| 177 | m_partitions.push_back(itotal); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | |
| 182 | void ChipperFilter::decideSplit(ChipRefList& v1, ChipRefList& v2, |