本文整理汇总了C++中ofRectangle::inside方法的典型用法代码示例。如果您正苦于以下问题:C++ ofRectangle::inside方法的具体用法?C++ ofRectangle::inside怎么用?C++ ofRectangle::inside使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofRectangle
的用法示例。
在下文中一共展示了ofRectangle::inside方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressed
void mousePressed(int x, int y, int button) {
x /= globalScale;
y /= globalScale;
canvas.mousePressed(x, y, button);
side.mousePressed(x, y, button);
// cout << btnHelpPos.distance(ofPoint(x,y)) << endl;
if (btnHelpPos.distance(ofPoint(x,y))<btnHelp.width/2) showHelp();
if (btnNew.hitTest(x,y)) { files.cur=-1; canvas.clear(); files.unloadFile(); }
if (btnSave.hitTest(x,y)) files.save();
if (btnLoadPrevious.hitTest(x,y)) files.loadPrevious();
if (btnLoadNext.hitTest(x,y)) files.loadNext();
if (btnPrint.hitTest(x,y)) print();
if (btnStop.hitTest(x,y)) stop();
if (btnOops.hitTest(x,y)) { btnOops.selected=true; }
if (btnZoomIn.hitTest(x,y)) btnZoomIn.selected=true;
if (btnZoomOut.hitTest(x,y)) btnZoomOut.selected=true;
if (btnHigher.hitTest(x,y)) btnHigher.selected=true;
if (btnLower.hitTest(x,y)) btnLower.selected=true;
if (btnTwistLeft.hitTest(x,y)) btnTwistLeft.selected=true;
if (btnTwistRight.hitTest(x,y)) btnTwistRight.selected=true;
if (shapeButtons.inside(x,y)) {
int index = ofNormalize(x,shapeButtons.x,shapeButtons.x+shapeButtons.width) * shapeString.size();
side.setShape(shapeString.at(index));
}
}
示例2: mouseMoved
void mouseMoved(int x, int y) {
x /= globalScale;
y /= globalScale;
if (shapeButtons.inside(x,y)) {
previewShape = shapeString.at(ofNormalize(x,shapeButtons.x,shapeButtons.x+shapeButtons.width) * shapeString.size());
} else {
previewShape = 0;
}
}
示例3:
vector<MeshPoint*> MeshHelper::getHit(const ofRectangle &test) const
{
vector<MeshPoint*> ret;
const vector<MeshPoint*> &points = target_->getPoints();
for(auto &p : points) {
if(test.inside(p->point())) {
ret.push_back(p);
}
}
return ret;
}
示例4: applyVectorField
void ofxParticleSystem::applyVectorField(float * field, int fieldWidth, int fieldHeight, int numComponents, ofRectangle areaOfInfluence, float force) {
for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++){
ofxParticle & p = (**it);
ofVec2f pos(p.position.x,p.position.y);
if(areaOfInfluence.inside(pos)){
int x = (int)ofMap(pos.x, areaOfInfluence.getMinX(), areaOfInfluence.getMaxX(), 0, fieldWidth-1);
int y = (int)ofMap(pos.y, areaOfInfluence.getMinY(), areaOfInfluence.getMaxY(), 0, fieldHeight-1);
int index = (x+y*fieldWidth)*numComponents;
ofVec2f dir(field[index],field[index+1]);
dir.scale(force);
// cout << "(" << dir.x << "," << dir.y << ")\n";
p.applyForce(dir);
}
}
}