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


C++ Corner类代码示例

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


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

示例1: setMacrosPositionByCorners

void CornerSequence::setMacrosPositionByCorners() {
    for (int i = 0; i < macros->size(); ++i) {
        Macro *macro = macros->at(i);
        macro->setOrientation(orientations->at(i));
        Corner *corner = corners->at(i);
        switch (corner->getDirection()) {
        case 0:
            macro->setXStart(corner->getX());
            macro->setYStart(corner->getY());
            break;
        case 1:
            macro->setXEnd(corner->getX());
            macro->setYStart(corner->getY());
            break;
        case 2:
            macro->setXStart(corner->getX());
            macro->setYEnd(corner->getY());
            break;
        case 3:
            macro->setXEnd(corner->getX());
            macro->setYEnd(corner->getY());
            break;
        }
        macro->updateRectanglesPosition();
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:26,代码来源:CornerSequence.cpp

示例2: keepTrackingCornersAndFindObjectLocationPixels

  void keepTrackingCornersAndFindObjectLocationPixels(vector<Point> &corners) {
    left_corner_.trackCorner(corners, right_corner_);
    right_corner_.trackCorner(corners, left_corner_);

    object_location_pixels_x_ = left_corner_.point_.x + corner_distance_ /2 - image_middle_x_;
    cout << "Delta X by pixels " << object_location_pixels_x_ << endl;
  }
开发者ID:Jyrks,项目名称:visual_servoing,代码行数:7,代码来源:manipulator_adjuster.cpp

示例3: getCornerCoords

Point Size::getCornerCoords(const Point& p, const Corner& c)
{
	Point rel = p;
	if (c.getX() == Right)
		rel.x = getWidth()  - 1 - rel.x;
	if (c.getY() == Bottom)
		rel.y = getHeight() - 1 - rel.y;
	return rel;
}
开发者ID:flanglois,项目名称:Lima,代码行数:9,代码来源:SizeUtils.cpp

示例4: changeCorner

void CornerSequence::changeCorner(int i) {
    Corner *corner = corners->at(i);
    if (corner != 0) {
        if (corner->isNotFromTilePlane()) {
            delete corner;
        }
        corners->at(i) = 0;
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:9,代码来源:CornerSequence.cpp

示例5: getVertexes

string Graph::currentGraphType() {

    int count = 0;
    bool weighted = false;
    bool directional = false;
    bool pseudoGraph = false;
    string graphTypes = "This graph is: ";

    vector<Vertex *> vertexes = getVertexes();

    for (vector<Vertex *>::iterator it = vertexes.begin(); it != vertexes.end(); it++) {

        Vertex *vertex = *it;
        vector<Adjacency *> adjacencies = vertex->getAdjacencies();

        for (vector<Adjacency *>::iterator secondIt = adjacencies.begin(); secondIt != adjacencies.end(); secondIt++) {

            Adjacency *adjacency = *secondIt;
            Corner *corner = adjacency->getCorner();
            Vertex *convergent = corner->getConvergent();
            Vertex *divergent = corner->getDivergent();

            if (!weighted && corner->getWeight() != -1) {
                weighted = true;
            }
            if (!pseudoGraph && corner->isCycle()) {
                pseudoGraph = true;
            }
            if (!directional && (convergent == nullptr || divergent == nullptr)) {
                directional = true;
            }
            count++;
        }
    }

    if (directional) {

        graphTypes += " -> directional";
    }
    if (!directional && count != 0) {
        graphTypes += " -> not directional";
    }
    if (weighted) {

        graphTypes += " -> weighted";
    }
    if (pseudoGraph) {

        graphTypes += " -> pseudoGraph";
    }
    if (count == 0) {

        graphTypes += " -> null graph";
    }

    return graphTypes;
}
开发者ID:carloseduardosx,项目名称:Graphs,代码行数:57,代码来源:Graph.cpp

示例6: C

Point Patch::K(int ei, int i){
    Corner* ci = C(ei);
    Spline* c = ci->E()->pData->pCurve;
    /*if (!c)
        return (i<2)?(ci->P()*(1-i) + ci->next()->P()*i) : (ci->P()*(i-2) + ci->next()->P()*(1-t));*/

    bool curvedir = (ci->V()->pData->pP() == c->pCV(0));
    bool rev = ((ei>1) && curvedir) || ( (ei<2) && !curvedir);
    return (rev)?c->CV(3-i):c->CV(i);
}
开发者ID:kingyy2013,项目名称:shady,代码行数:10,代码来源:patch.cpp

示例7: randomizeSequence

void CornerSequence::randomizeSequence(int start) {
    // Macros
    std::random_shuffle(macros->begin() + start, macros->end());

    // Corners
    for (int i = 0; i < corners->size(); ++i) {
        Corner *corner = corners->at(i);
        if (corner != 0) {
            if (corner->isNotFromTilePlane()) {
                delete corner;
            }
            corners->at(i) = 0;
        }
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:15,代码来源:CornerSequence.cpp

示例8: updateAllWeight

void Graph::updateAllWeight(Vertex *vertex) {

    vector<Adjacency *> adjacencies = vertex->getAdjacencies();

    for (vector<Adjacency *>::iterator it = adjacencies.begin(); it != adjacencies.end(); it++) {

        Adjacency *adjacency = *it;

        Corner *corner = adjacency->getCorner();

        if (corner->getWeight() == -1) {
            corner->setWeight(0);
        }
    }
}
开发者ID:carloseduardosx,项目名称:Graphs,代码行数:15,代码来源:Graph.cpp

示例9: CornerHorizontalTilePlane

CornerSequence::CornerSequence(int xStart, int yStart, int xEnd, int yEnd, int numMacros,
    //std::set<Macro *, CompareMacroWidth> *initialWidthSortedMacros,
    //std::set<Macro *, CompareMacroHeight> *initialHeightSortedMacros) {
    SortedMacros *initialWidthSortedMacros, SortedMacros *initialHeightSortedMacros) {
    fixedMacros = new std::vector<Macro *>();
    macros = new std::vector<Macro *>();
    corners = new std::vector<Corner *>();
    orientations = new std::vector<int>(numMacros, 0);
    macros->reserve(numMacros);
    corners->reserve(numMacros);
    cornerHorizontalTilePlane = new CornerHorizontalTilePlane(xStart, yStart, xEnd, yEnd);
    cornerVerticalTilePlane = new CornerVerticalTilePlane(xStart, yStart, xEnd, yEnd);
    cornerHorizontalTilePlane->coupleWithCornerVerticalTilePlane(cornerVerticalTilePlane);
    cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
    cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
    sizeQuadtree = new Quadtree(0, 0, xEnd - xStart + 1, yEnd - yStart + 1, new CornerSize()); // +1 for containing Corners with the size of floorplan.
    positionQuadtree = new Quadtree(xStart, yStart, xEnd + 1, yEnd + 1, new CornerPosition());

    // Insert Corners to quadtrees.
    std::vector<Corner *> *createdCorners = cornerHorizontalTilePlane->getCurrentlyCreatedCorners();
    for (int i = 0; i < createdCorners->size(); ++i) {
        Corner *corner = createdCorners->at(i);
        corner->updateWidthAndHeightForSorting();
        sizeQuadtree->insert(corner);
        positionQuadtree->insert(corner);
    }
    createdCorners = cornerVerticalTilePlane->getCurrentlyCreatedCorners();
    for (int i = 0; i < createdCorners->size(); ++i) {
        Corner *corner = createdCorners->at(i);
        corner->updateWidthAndHeightForSorting();
        if (corner->isType1()) {
            sizeQuadtree->insert(corner);
            positionQuadtree->insert(corner);
        }
    }

    this->initialWidthSortedMacros = initialWidthSortedMacros;
    this->initialHeightSortedMacros = initialHeightSortedMacros;
    //widthSortedMacros = new std::set<Macro *, CompareMacroWidth>(*initialWidthSortedMacros);
    //heightSortedMacros = new std::set<Macro *, CompareMacroHeight>(*initialHeightSortedMacros);
    //widthSortedMacros = new SortedMacros(initialWidthSortedMacros);
    //heightSortedMacros = new SortedMacros(initialHeightSortedMacros);
    widthSortedMacros = new SortedMacros(true);
    heightSortedMacros = new SortedMacros(true);

    indexPlacedUnsuccessfully = numMacros;
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:47,代码来源:CornerSequence.cpp

示例10:

CornerSequence::~CornerSequence() {
    delete macros;
    for (int i = 0; i < corners->size(); ++i) {
        Corner *corner = corners->at(i);
        if (corner != 0 && corner->isNotFromTilePlane()) {
            delete corner;
        }
    }
    delete corners;
    delete orientations;
    delete cornerHorizontalTilePlane;
    delete cornerVerticalTilePlane;
    delete sizeQuadtree;
    delete positionQuadtree;
    //delete widthSortedMacros;
    delete heightSortedMacros;
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:17,代码来源:CornerSequence.cpp

示例11: CornerSequence

CornerSequence *CornerSequence::copy() {
    CornerSequence *copiedCornerSequence = new CornerSequence(
        cornerHorizontalTilePlane->getXStart(),
        cornerHorizontalTilePlane->getYStart(),
        cornerHorizontalTilePlane->getXEnd(),
        cornerHorizontalTilePlane->getYEnd(),
        macros->size(), initialWidthSortedMacros, initialHeightSortedMacros);
    for (int i = 0; i < fixedMacros->size(); ++i) {
        copiedCornerSequence->addFixedMacro(fixedMacros->at(i));
    }
    for (int i = 0; i < macros->size(); ++i) {
        Corner *corner = corners->at(i);
        if (corner != 0) {
            corner = corner->copyAsNotFromTilePlane();
        }
        copiedCornerSequence->addMacroCornerPair(macros->at(i), corner);
        copiedCornerSequence->setOrientation(i, orientations->at(i));
    }
    return copiedCornerSequence;
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:20,代码来源:CornerSequence.cpp

示例12:

Corner * CornerCollection::GetAbove(Corner* corner)
{
								Corner * closet_corner = 0;
								int smallest_distance = SCREEN_WIDTH;
								Position * corner_pos = corner->GetPosition();

								std::vector<Corner*>::iterator iterador = vector.begin();

								for (; iterador < vector.end(); iterador++)
								{
																Corner * c = (*iterador);
																Position * c_pos = c->GetPosition();

																int dist = corner_pos->Distance(c_pos);

																if ((dist != 0) && (dist < smallest_distance) && (corner_pos->SameColumn(c_pos)))
																{
																								smallest_distance = dist;
																								closet_corner = c;
																}
								}

								return closet_corner;
}
开发者ID:andrepontesmelo,项目名称:pacman-cpp,代码行数:24,代码来源:CornerCollection.cpp

示例13: if

bool CornerNode::getValue (const String& strMemberName, String& strValue)
{
    bool bValueSet = false;
    Corner* pObject = dynamic_cast<Corner*>(m_pObject);
    if (strMemberName == L"value")
    {
        ValueObject* pValueObj = dynamic_cast<ValueObject*>(m_pObject);
        if (pValueObj)
        {
            if (!pValueObj->isNothing())
            {
                strValue = pValueObj->toString();
                bValueSet = true;
            }
        }
    }
    else if (strMemberName == L"StaStart")
    {
        if (pObject->hasValue_StaStart())
        {
            strValue = (DoubleObjectImpl(pObject->getStaStart())).toString();
            bValueSet = true;
        }
    }
    else if (strMemberName == L"StaEnd")
    {
        if (pObject->hasValue_StaEnd())
        {
            strValue = (DoubleObjectImpl(pObject->getStaEnd())).toString();
            bValueSet = true;
        }
    }
    else if (strMemberName == L"Type")
    {
        if (pObject->hasValue_Type())
        {
            strValue = (EnumCornerTypeImpl(pObject->getType())).toString();
            bValueSet = true;
        }
    }
    return bValueSet;
}
开发者ID:klainqin,项目名称:LandXmlSDK,代码行数:42,代码来源:LXNodes62.cpp

示例14: setValue

bool CornerNode::setValue (const String& strMemberName, const String* pstrValue)
{
    bool bValueSet = false;
    Corner* pObject = dynamic_cast<Corner*>(m_pObject);
    if (strMemberName == L"StaStart")
    {
        if (!pstrValue)
        {
            pObject->resetValue_StaStart();
        }
        else
        {
            pObject->setStaStart(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
            bValueSet = true;
        }
    }
    if (strMemberName == L"StaEnd")
    {
        if (!pstrValue)
        {
            pObject->resetValue_StaEnd();
        }
        else
        {
            pObject->setStaEnd(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
            bValueSet = true;
        }
    }
    if (strMemberName == L"Type")
    {
        if (!pstrValue)
        {
            pObject->resetValue_Type();
        }
        else
        {
            pObject->setType(EnumCornerTypeImpl::parseString(pstrValue->c_str(), pstrValue->length()));
            bValueSet = true;
        }
    }
    return bValueSet;
}
开发者ID:klainqin,项目名称:LandXmlSDK,代码行数:42,代码来源:LXNodes62.cpp

示例15: while

void CornerSequence::fillInWastedRegion() {
    std::cout << "fillInWastedRegion()\n";
    int smallestMacroWidth = widthSortedMacros->getSmallest()->getWidth();
    int smallestMacroHeight = heightSortedMacros->getSmallest()->getHeight();
    while (true) {
        int numFills = 0;
        // Try to fill a horizontal empty Tile.
        Tile *emptyTile = cornerHorizontalTilePlane->getEmptyTileWithSmallestWidth();
        if (emptyTile != 0 && emptyTile->getWidth() < smallestMacroWidth) {
            std::cout << "fill horizontalTile\n";
            emptyTile->print();
            Tile *horizontalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            Tile *verticalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            horizontalTile->setTemporarilySolid();
            verticalTile->setTemporarilySolid();
            // Find startVerticalTile.
            Corner *corner = emptyTile->getBlCorner();
            Tile *startVerticalTile;
            if (corner == 0) {
                corner = emptyTile->getTlCorner();
            }
            if (corner != 0) {
                startVerticalTile = corner->getVerticalTile();
            } else {
                // If emptyTile has no Corner, than emptyTile's lb and rt
                // are empty Tiles, and lb has top Corners and rt has bottom Corners.
                startVerticalTile = cornerVerticalTilePlane->findTile(emptyTile->getXStart(), emptyTile->getYStart(),
                    emptyTile->getRt()->getBlCorner()->getVerticalTile());
            }
            // Place horizontalTile.
            std::cout << "place horizontal\n";
            cornerHorizontalTilePlane->placeSolidTileGivenBothStartTiles(horizontalTile, emptyTile, startVerticalTile);
            // Place verticalTile.
            std::cout << "place vertical\n";
            cornerVerticalTilePlane->placeSolidTileGivenBothStartTiles(verticalTile, horizontalTile, startVerticalTile);

            cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
            cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
            std::cout << "updateQuadtrees()\n";
            updateQuadtrees();
            std::cout << "updateQuadtrees() end\n";

            numFills += 1;
        }
        // Try to fill a vertical empty Tile.
        emptyTile = cornerVerticalTilePlane->getEmptyTileWithSmallestHeight();
        if (emptyTile != 0 && emptyTile->getHeight() < smallestMacroHeight) {
            std::cout << "fill verticalTile\n";
            emptyTile->print();
            Tile *horizontalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            Tile *verticalTile = new Tile(emptyTile->getXStart(), emptyTile->getYStart(),
                emptyTile->getXEnd(), emptyTile->getYEnd(), true);
            horizontalTile->setTemporarilySolid();
            verticalTile->setTemporarilySolid();
            // Find startHorizontalTile.
            Corner *corner = emptyTile->getBlCorner();
            Tile *startHorizontalTile;
            if (corner == 0) {
                corner = emptyTile->getBrCorner();
            }
            if (corner != 0) {
                corner->print();
                startHorizontalTile = corner->getHorizontalTile();
                cornerHorizontalTilePlane->getBottomRightMostTile()->print();
            } else {
                // If emptyTile has no Corner, than emptyTile's bl and tr
                // are empty Tiles, and bl has right Corners and tr has left Corners.
                startHorizontalTile = cornerHorizontalTilePlane->findTile(emptyTile->getXStart(), emptyTile->getYStart(),
                    emptyTile->getTr()->getBlCorner()->getHorizontalTile());
            }
            // Place horizontalTile.
            std::cout << "place horizontal\n";
            horizontalTile->print();
            startHorizontalTile->print();
            startHorizontalTile->printFourNeighbors();
            cornerHorizontalTilePlane->placeSolidTileGivenBothStartTiles(horizontalTile, startHorizontalTile, emptyTile);
            // Place verticalTile.
            std::cout << "place vertical\n";
            cornerVerticalTilePlane->placeSolidTileGivenBothStartTiles(verticalTile, horizontalTile, emptyTile);

            cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
            cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
            std::cout << "updateQuadtrees()\n";
            updateQuadtrees();
            std::cout << "updateQuadtrees() end\n";

            numFills += 1;
        }
        // Continue or not.
        if (numFills == 0) {
            break;
        }
    }
}
开发者ID:areong,项目名称:CornerMacroPlacer,代码行数:97,代码来源:CornerSequence.cpp


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