当前位置: 首页>>代码示例>>C++>>正文


C++ Coordinate::capped方法代码示例

本文整理汇总了C++中Coordinate::capped方法的典型用法代码示例。如果您正苦于以下问题:C++ Coordinate::capped方法的具体用法?C++ Coordinate::capped怎么用?C++ Coordinate::capped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Coordinate的用法示例。


在下文中一共展示了Coordinate::capped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processRegion

CubeCoordSet processRegion(const Coordinate & globalFirst, const Coordinate &  globalLast, Func func, Skip skip) {
    const auto cubeBegin = globalFirst.cube(state->cubeEdgeLength, state->magnification);
    const auto cubeEnd = globalLast.cube(state->cubeEdgeLength, state->magnification) + 1;
    CubeCoordSet cubeCoords;

    //traverse all remaining cubes
    for (int z = cubeBegin.z; z < cubeEnd.z; ++z)
    for (int y = cubeBegin.y; y < cubeEnd.y; ++y)
    for (int x = cubeBegin.x; x < cubeEnd.x; ++x) {
        skip(x, y, z);//skip cubes which got processed before
        const auto cubeCoord = CoordOfCube(x, y, z);
        const auto globalCubeBegin = cubeCoord.cube2Global(state->cubeEdgeLength, state->magnification);
        auto rawcube = getRawCube(globalCubeBegin);
        if (rawcube.first) {
            auto cubeRef = getCubeRef(rawcube.second);
            const auto globalCubeEnd = globalCubeBegin + state->cubeEdgeLength * state->magnification - 1;
            const auto localStart = globalFirst.capped(globalCubeBegin, globalCubeEnd).insideCube(state->cubeEdgeLength, state->magnification);
            const auto localEnd = globalLast.capped(globalCubeBegin, globalCubeEnd).insideCube(state->cubeEdgeLength, state->magnification);

            for (int z = localStart.z; z <= localEnd.z; ++z)
            for (int y = localStart.y; y <= localEnd.y; ++y)
            for (int x = localStart.x; x <= localEnd.x; ++x) {
                const Coordinate globalCoord{globalCubeBegin.x + x * state->magnification, globalCubeBegin.y + y * state->magnification, globalCubeBegin.z + z * state->magnification};
                func(cubeRef[z][y][x], globalCoord);
            }
            cubeCoords.emplace(cubeCoord);
        } else {
            qCritical() << x << y << z << "cube missing for (partial) writeVoxels";
        }
    }
    return cubeCoords;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: updateMovementArea

void Annotation::updateMovementArea(const Coordinate & min, const Coordinate & max) {
    movementAreaMin = min.capped({0, 0, 0}, Dataset::current().boundary);
    movementAreaMax = max.capped({0, 0, 0}, Dataset::current().boundary);
    emit movementAreaChanged();
}
开发者ID:knossos-project,项目名称:knossos,代码行数:5,代码来源:annotation.cpp


注:本文中的Coordinate::capped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。