本文整理汇总了C++中Blob::getRightTopX方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::getRightTopX方法的具体用法?C++ Blob::getRightTopX怎么用?C++ Blob::getRightTopX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob::getRightTopX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBlob
/* Draws the outline of a blob in the specified color.
* @param b the blob
* @param c the color to paint
*/
void Ball::drawBlob(Blob b, int c) {
#ifdef OFFLINE
thresh->drawLine(b.getLeftTopX(), b.getLeftTopY(),
b.getRightTopX(), b.getRightTopY(),
c);
thresh->drawLine(b.getLeftTopX(), b.getLeftTopY(),
b.getLeftBottomX(), b.getLeftBottomY(),
c);
thresh->drawLine(b.getLeftBottomX(), b.getLeftBottomY(),
b.getRightBottomX(), b.getRightBottomY(),
c);
thresh->drawLine(b.getRightTopX(), b.getRightTopY(),
b.getRightBottomX(), b.getRightBottomY(),
c);
#endif
}
示例2: printBlob
/* Print debugging information for a blob.
* @param b the blob
*/
void Robots::printBlob(Blob b) {
#if defined OFFLINE
cout << "Outputting blob" << endl;
cout << b.getLeftTopX() << " " << b.getLeftTopY() << " " << b.getRightTopX() << " "
<< b.getRightTopY() << endl;
cout << b.getLeftBottomX() << " " << b.getLeftBottomY() << " " << b.getRightBottomX()
<< " " << b.getRightBottomY() << endl;
#endif
}
示例3: updateRobot
/**
* Update the robot values from the blob
*
* @param b The blob to update our object from.
*/
void VisualRobot::updateRobot(Blob b)
{
setLeftTopX(b.getLeftTopX());
setLeftTopY(b.getLeftTopY());
setLeftBottomX(b.getLeftBottomX());
setLeftBottomY(b.getLeftBottomY());
setRightTopX(b.getRightTopX());
setRightTopY(b.getRightTopY());
setRightBottomX(b.getRightBottomX());
setRightBottomY(b.getRightBottomY());
setX(b.getLeftTopX());
setY(b.getLeftTopY());
setWidth(dist(b.getRightTopX(), b.getRightTopY(), b.getLeftTopX(),
b.getLeftTopY()));
setHeight(dist(b.getLeftTopX(), b.getLeftTopY(), b.getLeftBottomX(),
b.getLeftBottomY()));
setCenterX(getLeftTopX() + ROUND2(getWidth() / 2));
setCenterY(getRightTopY() + ROUND2(getHeight() / 2));
setDistance(1);
}
示例4: ballNearGreen
int Ball::ballNearGreen(Blob b)
{
const int EXTRA_LINES = 6;
// first check the bottom
int w = b.width();
int h = b.height();
int where = NOGREEN;
if (greenCheck(b))
where = where * GREENBELOW;
// now try the sides - happily the ball is round so we don't have to worry
// about scan angles
int x = b.getLeftTopX();
int y = b.getLeftTopY();
for (int i = 0; i < h && y + i < IMAGE_HEIGHT && where % GREENLEFT != 0;
i= i+2) {
for (int j =-1; j < EXTRA_LINES && x + j > -1 && where % GREENLEFT != 0;
j++) {
if (thresh->thresholded[i+y][x - j] == GREEN) {
where = where * GREENLEFT;
}
}
}
for (int i = 0; i < w && x + i < IMAGE_WIDTH && where % GREENABOVE != 0;
i= i+2) {
for (int j = 0; j < EXTRA_LINES && y - j > 0 && where % GREENABOVE != 0;
j++) {
if (thresh->thresholded[i+y][j+x] == GREEN) {
where = where * GREENABOVE;
}
}
}
x = b.getRightTopX();
y = b.getRightTopY();
for (int i = 0; i < h && y + i < IMAGE_HEIGHT && where % GREENRIGHT != 0;
i= i+2) {
for (int j = 0; j < EXTRA_LINES && x + j < IMAGE_WIDTH &&
where % GREENRIGHT != 0; j++) {
if (thresh->thresholded[i+y][j+x] == GREEN) {
where = where * GREENRIGHT;
}
}
}
// put in the case where we don't have any, but want to check the corners
return where;
}
示例5: atBoundary
/* Is the ball at the boundary of the screen?
* @param b the ball
* @return whether or not it borders a boundary
*/
bool Ball::atBoundary(Blob b) {
return b.getLeftTopX() == 0 || b.getRightTopX() >= IMAGE_WIDTH -1 ||
b.getLeftTopY() == 0
|| b.getLeftBottomY() >= IMAGE_HEIGHT - 1;
}