| 309 | } |
| 310 | |
| 311 | QuadContourGenerator::QuadContourGenerator(const CoordinateArray &x, |
| 312 | const CoordinateArray &y, |
| 313 | const CoordinateArray &z, |
| 314 | bool corner_mask, |
| 315 | long chunk_size) |
| 316 | : _x(x), _y(y), _z(z), _nx(static_cast<long>(_x[0].size())), |
| 317 | _ny(static_cast<long>(_x.size())), _n(_nx * _ny), |
| 318 | _corner_mask(corner_mask), |
| 319 | _chunk_size(chunk_size > 0 |
| 320 | ? std::min(chunk_size, std::max(_nx, _ny) - 1) |
| 321 | : std::max(_nx, _ny) - 1), |
| 322 | _nxchunk(calc_chunk_count(_nx)), _nychunk(calc_chunk_count(_ny)), |
| 323 | _chunk_count(_nxchunk * _nychunk), _cache(std::vector<CacheItem>(_n)), |
| 324 | _parent_cache(_nx, chunk_size > 0 ? chunk_size + 1 : _nx, |
| 325 | chunk_size > 0 ? chunk_size + 1 : _ny) { |
| 326 | assert(!_x.empty() && !_y.empty() && !_z.empty() && "Empty array"); |
| 327 | assert(_y.size() == _x.size() && _y[0].size() == _x[0].size() && |
| 328 | "Different-sized y and x arrays"); |
| 329 | assert(_z.size() == _x.size() && _z[0].size() == _x[0].size() && |
| 330 | "Different-sized z and x arrays"); |
| 331 | |
| 332 | init_cache_grid(); |
| 333 | } |
| 334 | |
| 335 | void QuadContourGenerator::append_contour_line_to_vertices( |
| 336 | ContourLine &contour_line, vertices_list_type &vertices_list) const { |