本文整理汇总了C++中Corner::getX方法的典型用法代码示例。如果您正苦于以下问题:C++ Corner::getX方法的具体用法?C++ Corner::getX怎么用?C++ Corner::getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corner
的用法示例。
在下文中一共展示了Corner::getX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例2: 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;
}
示例3: placeMacrosWithIncrementalUpdate
bool CornerSequence::placeMacrosWithIncrementalUpdate(int startPosition, int backupPosition) {
bool placedUnsuccessfully = false;
// Store Corners removed from sizeQuadtree during finding valid Corners.
std::vector<Corner *> *temporarilyRemovedCorners = new std::vector<Corner *>();
for (int i = startPosition; i < macros->size(); ++i) {
//std::cout << i << "\n";
Macro *macro = macros->at(i);
macro->setOrientation(orientations->at(i));
int macroWidth = macro->getWidth();
int macroHeight = macro->getHeight();
Corner *corner = corners->at(i);
//std::cout << "begin Macro " << i << "\n";
//std::cout << "smallest width emtpy Tile: ";
//cornerHorizontalTilePlane->getEmptyTileWithSmallestWidth()->print();
//std::cout << "smallest height empty Tile: ";
//cornerVerticalTilePlane->getEmptyTileWithSmallestHeight()->print();
//std::cout << "smallest width Macro: ";
//////(*widthSortedMacros->begin())->print();
//widthSortedMacros->getSmallest()->print();
//std::cout << "smallest height Macro: ";
////(*heightSortedMacros->begin())->print();
//heightSortedMacros->getSmallest()->print();
//fillInWastedRegion();
// Check whether to select another Corner.
bool toSelectAnotherCorner = false;
if (corner == 0) {
toSelectAnotherCorner = true;
} else if (corner->isNotFromTilePlane()) {
Corner *inputCorner = corner;
std::vector<Point *> *foundCorners = positionQuadtree->getPointsAtXY(inputCorner->getX(), inputCorner->getY());
if (foundCorners == 0) {
// No matched Corner is found.
toSelectAnotherCorner = true;
} else {
for (int j = 0; j < foundCorners->size(); ++j) {
Corner *foundCorner = static_cast<Corner *>(foundCorners->at(j));
if (foundCorner->getDirection() == inputCorner->getDirection()) {
// The matched Corner is found.
corner = foundCorner;
break;
}
// No matched Corner is found.
toSelectAnotherCorner = true;
}
delete foundCorners;
}
delete inputCorner;
corners->at(i) = 0;
// If macro ends up being unsuccessfully placed,
// notFromTilePlane Corners after corner will be deleted in ~CornerSeqence().
}
if (toSelectAnotherCorner) {
corner = static_cast<Corner *>(sizeQuadtree->getPointRandomlyByXY(macroWidth, macroHeight, true, true));
if (corner == 0) {
// No Corner is available.
placedUnsuccessfully = true;
indexPlacedUnsuccessfully = i;
break;
}
}
// Check overlap.
int cornerDirection;
int macroXStart;
int macroYStart;
int macroXEnd;
int macroYEnd;
int cornerX;
int cornerY;
while (true) {
// Check corner gap size.
bool cornerGapSizeIsValid = true;
if (corner->isType1()) {
if (corner->isGapOnHorizontalSide()) {
if (corner->getGapSize() >= macroWidth) {
cornerGapSizeIsValid = false;
}
} else {
if (corner->getGapSize() >= macroHeight) {
cornerGapSizeIsValid = false;
}
}
}
if (cornerGapSizeIsValid) {
// Calculate macro position.
cornerX = corner->getX();
cornerY = corner->getY();
cornerDirection = corner->getDirection();
switch (cornerDirection) {
case 0:
// Bl
macroXStart = cornerX;
macroYStart = cornerY;
//.........这里部分代码省略.........