本文整理汇总了C++中ofPolyline::getBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPolyline::getBoundingBox方法的具体用法?C++ ofPolyline::getBoundingBox怎么用?C++ ofPolyline::getBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPolyline
的用法示例。
在下文中一共展示了ofPolyline::getBoundingBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calibrationDone
void testApp::calibrationDone(ofPolyline &_surface){
ofLog(OF_LOG_NOTICE, "Calibration done");
if ( bStart )
killGame();
if (activeGameName == "simon"){
game = new Simon();
} else if (activeGameName == "pong"){
game = new Pong();
} else if (activeGameName == "shadows"){
game = new Shadows();
} else if (activeGameName == "oca"){
game = new Oca();
} else if (activeGameName == "communitas"){
game = new Communitas();
} else if (activeGameName == "kaleido"){
game = new Kaleido();
}
if (game != NULL){
ofLog(OF_LOG_NOTICE, "Game " + activeGameName + " loaded");
game->init( _surface.getBoundingBox() );
iSurface.setTrackMode( game->getTrackMode() );
bStart = true;
} else {
ofLog(OF_LOG_ERROR, "Game " + activeGameName + " not loaded.");
bStart = false;
}
}
示例2: draw_featEnMarco
void scanner_faces::draw_featEnMarco(ofPolyline feat, int gap, bool uu, bool rr) {
ofRectangle featRect;
featRect = feat.getBoundingBox();
featRect.x-=gap;
featRect.y-=gap;
featRect.width+=2*gap;
featRect.height+=2*gap;
ofSetLineWidth(1);
if(rr) {
ofLine(marco.rect.x-marco.gap, featRect.y, featRect.x, featRect.y);
ofLine(marco.rect.x-marco.gap, featRect.y+featRect.height, featRect.x, featRect.y+featRect.height);
}
else {
ofLine(marco.rect.x+marco.rect.width+marco.gap, featRect.y, featRect.x, featRect.y);
ofLine(marco.rect.x+marco.rect.width+marco.gap, featRect.y+featRect.height, featRect.x, featRect.y+featRect.height);
}
if(uu) {
ofLine(featRect.x, featRect.y, featRect.x, marco.rect.y-marco.gap);
ofLine(featRect.x+marco.rect.width, featRect.y, featRect.x+marco.rect.width+marco.gap, featRect.y);
}
else {
ofLine(featRect.x, featRect.y, featRect.x, marco.rect.y+marco.rect.height+marco.gap);
ofLine(featRect.x+featRect.width, featRect.y,
featRect.x+featRect.width, marco.rect.y+marco.rect.height+marco.gap);
}
ofSetLineWidth(2.5);
ofRect(featRect);
}
示例3: oscSendContour
void testApp::oscSendContour(int label, const ofPolyline &polyline){
ofxOscMessage m;
stringstream ss;
ss<<"/contour";
m.setAddress(ss.str());
int size = polyline.size();
m.addIntArg(label);
m.addIntArg(size);
cout<<"contour: "<<label<<" size: "<<size<<endl;
const ofRectangle& rect = polyline.getBoundingBox();
m.addIntArg(rect.getTopLeft().x);
m.addIntArg(rect.getTopLeft().y);
m.addIntArg(rect.getBottomRight().x);
m.addIntArg(rect.getBottomRight().y);
ofPolyline newLine = polyline.getResampledByCount(100);
cout<<"resized to "<<newLine.size()<<endl;
// newLine.draw();
if(bSendContours){
const vector<ofPoint> points = newLine.getVertices();
for(int i=0; i< newLine.size(); i++){
m.addFloatArg(points[i].x);
m.addFloatArg(points[i].y);
}
}
sender.sendMessage(m);
}
示例4: compareBoundingBox
/*
* This function takes a polyline and checks whether its bounding box (along the x-axis) is within that of the face's.
* This is more reliable than simply checking whether that polyline's centroid lies within the face's bounding box because we
* get rid of ancilliary polylines that might cover huge regions of the image plane (and thus have valid centroids) but aren't
* necessarily part of the facial features.
*/
bool FaceScanner::compareBoundingBox(ofPolyline &other, float distThreshold)
{
ofRectangle otherRect = other.getBoundingBox();
if ( otherRect.x > (m_faceBoundingBox.x - MIN_HORZ_DISTANCE_TO_FACE) &&
(otherRect.x + otherRect.width) < (m_faceBoundingBox.x + m_faceBoundingBox.width + MIN_HORZ_DISTANCE_TO_FACE) &&
otherRect.y > (m_faceBoundingBox.y - MIN_VERT_DISTANCE_TO_FACE) &&
(otherRect.y + otherRect.height) < (m_faceBoundingBox.y + m_faceBoundingBox.height + MIN_VERT_DISTANCE_TO_FACE))
{
return true;
}
return false;
}