本文整理汇总了C++中GridType::width方法的典型用法代码示例。如果您正苦于以下问题:C++ GridType::width方法的具体用法?C++ GridType::width怎么用?C++ GridType::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridType
的用法示例。
在下文中一共展示了GridType::width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: distanceGrid
Grid3D<uint32_t> computeDistanceMap26_WithQueue(const GridType& grid, Predicate isInObject, bool outsideIsObject) {
auto w = grid.width(), h = grid.height(), d = grid.depth();
uint32_t maxDist = std::numeric_limits<uint32_t>::max();
Grid3D<uint32_t> distanceGrid(w, h, d, maxDist);
std::queue<Vec4i> queue;
for(auto z = 0u; z < d; ++z) {
for(auto y = 0u; y < h; ++y) {
for(auto x = 0u; x < w; ++x) {
auto voxel = Vec3i(x, y, z);
if(!isInObject(x, y, z, grid)) {
queue.push(Vec4i(voxel, 0u));
} else if(!outsideIsObject && (x == 0 || y == 0 || z == 0 || x == w - 1 || y == h - 1 || z == d - 1)) {
queue.push(Vec4i(voxel, 1u));
}
}
}
}
while(!queue.empty()) {
auto voxel = Vec3i(queue.front());
auto dist = queue.front().w;
queue.pop();
if(dist < distanceGrid(voxel)) {
distanceGrid(voxel) = dist;
foreach26Neighbour(grid.resolution(), voxel, [&](const Vec3i& neighbour) {
auto newDist = dist + 1;
if(newDist < distanceGrid(neighbour)) {
queue.push(Vec4i(neighbour, newDist));
}
});
}
}
return distanceGrid;
}