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


C++ point::getColumn方法代码示例

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


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

示例1: checkNeighbors

bool checkNeighbors(point currentPoint, grid * theGrid) {
    int row = currentPoint.getRow();
    int column = currentPoint.getColumn();
    int currentValue = theGrid->getValue(row,column);
    int status;
    
    if (row != 0) { // Neighbor to the north (Canada)
        status = checkPosition(row-1, column, currentValue, theGrid);
        if (status == 99) return true;
        else if (status == 1) pointQueue.enqueue(point(row-1,column));
    }
    if (row < theGrid->getSize() -1) { // Neighbor to the south (Mexico)
        status = checkPosition(row+1, column, currentValue, theGrid);
        if (status == 99) return true;
        else if (status == 1) pointQueue.enqueue(point(row+1,column));
    }
    if (column != 0) { // Neighbor to the west (Pacific)
        status = checkPosition(row, column-1, currentValue, theGrid);
        if (status == 99) return true;
        else if (status == 1) pointQueue.enqueue(point(row,column-1));
    }
    if (column < theGrid->getSize() -1) { // Neighbor to the east (Atlantic)
        status = checkPosition(row, column+1, currentValue, theGrid);
        if (status == 99) return true;
        else if (status == 1) pointQueue.enqueue(point(row,column+1));
    }
    return false;
}
开发者ID:josh-jacobson,项目名称:wire_routing,代码行数:28,代码来源:Utilities.cpp

示例2: checkNeighborsBackward

point checkNeighborsBackward(point currentPoint, grid * theGrid) {
    int row = currentPoint.getRow();
    int column = currentPoint.getColumn();
    int currentValue = theGrid->getValue(row,column);
    point nextPoint(row,column);
    
    if (row != 0) { // Neighbor to the north (Canada)
        if (theGrid->getValue(row-1,column) == currentValue-1) {
            nextPoint = point(row-1,column);
            pointStack.push(&nextPoint);
            return nextPoint;
        }
    }
    if (row < theGrid->getSize() -1) { // Neighbor to the south (Mexico)
        if (theGrid->getValue(row+1,column) == currentValue-1) {
            nextPoint = point(row+1,column);
            pointStack.push(&nextPoint);
            return nextPoint;
        }
    }
    if (column != 0) { // Neighbor to the west (Pacific)
        if (theGrid->getValue(row,column-1) == currentValue-1) {
            nextPoint = point(row,column-1);
            pointStack.push(&nextPoint);
            return nextPoint;
        }
    }
    if (column < theGrid->getSize() -1) { // Neighbor to the east (Atlantic)
        if (theGrid->getValue(row,column+1) == currentValue-1) {
            nextPoint = point(row,column+1);
            pointStack.push(&nextPoint);
            return nextPoint;
        }
    }
    return NULL;
}
开发者ID:josh-jacobson,项目名称:wire_routing,代码行数:36,代码来源:Utilities.cpp

示例3:

bool point::operator !=(point & other) {
    if ((other.getRow() == row) && (other.getColumn() == column)) return false;
    else return true;
}
开发者ID:josh-jacobson,项目名称:wire_routing,代码行数:4,代码来源:Utilities.cpp


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