本文整理汇总了C++中ofRectangle::getTop方法的典型用法代码示例。如果您正苦于以下问题:C++ ofRectangle::getTop方法的具体用法?C++ ofRectangle::getTop怎么用?C++ ofRectangle::getTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofRectangle
的用法示例。
在下文中一共展示了ofRectangle::getTop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawHorzAlignMark
//--------------------------------------------------------------
void testApp::drawHorzAlignMark(const ofRectangle& rect, const ofColor& color, ofAlignHorz hAlign) {
if(hAlign != OF_ALIGN_HORZ_IGNORE) {
float hAnchor = rect.getHorzAnchor(hAlign);
ofSetColor(color,120);
ofLine(hAnchor, rect.getTop() - 13, hAnchor, rect.getTop() - 3);
ofLine(hAnchor, rect.getBottom() + 13, hAnchor, rect.getBottom() + 3);
}
}
示例2: distributeVert
void RectangleUtils::distributeVert(RectanglePointers& rects,
const ofRectangle& boundingRect,
ofAlignVert vertAnchor)
{
if(rects.size() >= 3 && vertAnchor != OF_ALIGN_VERT_IGNORE) {
sortByVertAnchor(rects,vertAnchor);
float nPos = rects.size() - 1;
// adjust to bounding bounding rect. if bounding rect is based on the group, nothing will change
rects[0]->translateY(boundingRect.getTop() - rects[0]->getTop());
rects[nPos]->translateY(boundingRect.getBottom() - rects[nPos]->getBottom());
float topY = rects[0]->getVertAnchor(vertAnchor);
float bottomY = rects[nPos]->getVertAnchor(vertAnchor);
float span = ( bottomY - topY ) / ( nPos );
for(size_t i = 1; i < nPos; i++) {
rects[i]->translateY((topY - rects[i]->getVertAnchor(vertAnchor)) + i * span);
}
} else {
if(vertAnchor == OF_ALIGN_VERT_IGNORE) {
ofLogVerbose("ofDistributeVertical") << "OF_ALIGN_VERT_IGNORE distribute requested, ignoring.";
} else {
ofLogWarning("ofDistributeVertical") << "Not enough rectangles to distribute.";
}
}
}
示例3: setSensorCrop
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setSensorCrop(ofRectangle& rectangle)
{
sensorCropConfig.xLeft = ((uint32_t)rectangle.getLeft() << 16)/100;
sensorCropConfig.xTop = ((uint32_t)rectangle.getTop() << 16)/100;
sensorCropConfig.xWidth = ((uint32_t)rectangle.getWidth() << 16)/100;
sensorCropConfig.xHeight = ((uint32_t)rectangle.getHeight() << 16)/100;
OMX_ERRORTYPE error = OMX_SetConfig(camera, OMX_IndexConfigInputCropPercentages, &sensorCropConfig);
OMX_TRACE(error);
if(error != OMX_ErrorNone)
{
ofLogError(__func__) << omxErrorToString(error);
if(error == OMX_ErrorBadParameter)
{
ofLogWarning(__func__) << "resetting cropRectangle to known good params (0, 0, 100, 100)";
cropRectangle.set(0, 0, 100, 100);
return updateSensorCrop();
}
}
return error;
}
示例4: toClipper
ClipperLib::IntRect Clipper::toClipper(const ofRectangle& rectangle,
ClipperLib::cInt scale)
{
ClipperLib::IntRect rect;
rect.left = rectangle.getLeft() * scale;
rect.right = rectangle.getRight() * scale;
rect.top = rectangle.getTop() * scale;
rect.bottom = rectangle.getBottom() * scale;
return rect;
}
示例5: setRandomVehicleLocation
bool ofApp::setRandomVehicleLocation(ofRectangle area, bool liveInWater, ofVec2f & location){
bool okwater = false;
int count = 0;
int maxCount = 100;
while (!okwater && count < maxCount) {
count++;
float x = ofRandom(area.getLeft(),area.getRight());
float y = ofRandom(area.getTop(),area.getBottom());
bool insideWater = kinectProjector->elevationAtKinectCoord(x, y) < 0;
if ((insideWater && liveInWater) || (!insideWater && !liveInWater)){
location = ofVec2f(x, y);
okwater = true;
}
}
return okwater;
}
示例6:
void hlct::Helmet::update(const ofRectangle& stageRect, const ofRectangle& hitRect, const float& scale){
this->stageRect.set(stageRect);
this->scale = scale;
float imgW = img.getWidth() * scale;
float imgH = img.getHeight() * scale;
if (alive && position.y <= stageRect.getBottom() - imgH/2) {
if (!win) {
position.y -= gravity * 1.2;
} else {
position.x = hitRect.getCenter().x - imgW * 0.5;
position.y = hitRect.getTop() - imgH * 1.5;
}
} else {
alive = false;
}
intersectRect.set(position, imgW, imgH);
}
示例7: draw
void Trigger :: draw(ofRectangle area, int motionTargetThreshold) {
if(settings!=NULL) {
settings->update(deltaTime, values);
settings->draw(elapsedTime, pos, unitPower, active, scale, angle);
if(elapsedTime-lastTriggerTime<0.15) {
ofPushMatrix();
ofPushStyle();
ofTranslate(pos.x, pos.y);
float size = ofMap(elapsedTime - lastTriggerTime, 0, 0.15, 1, 0);
size*=size;
size*=settings->radius*5;
ofScale(size, size);
ofSetColor(settings->getColour());
flashImage.draw(-0.5, -0.5, 1,1);
ofScale(0.5,0.5);
flashImage.draw(-0.5, -0.5, 1,1);
ofPopStyle();
ofPopMatrix();
}
}
if(lastSettings!=NULL) {
lastSettings->update(deltaTime, values);
lastSettings->draw(elapsedTime, pos, unitPower, active, lastScale, angle);
}
if(!active) return;
if(showDebugData) {
ofPushMatrix();
ofPushStyle();
ofTranslate(pos);
ofSetColor(100,0,0);
ofNoFill();
ofRect(-triggerSampleSize/2, -triggerSampleSize/2, triggerSampleSize, triggerSampleSize);
ofTranslate(0, motionValueCount*-2);
ofFill();
for(float i = -0.5; i<=0.5 ; i++){
ofPushMatrix();
ofBeginShape();
ofScale(i,1);
ofVertex(-1,0);
float lastvalue = -1;
for(int i = 0; i<motionValues.size(); i++) {
float value = ofClamp(motionValues[i]*20, 0, 50);
if(value!=lastvalue) {
ofVertex(lastvalue,(i*2)-1);
ofVertex(value,i*2);
ofVertex(value,(i*2)+1);
}
lastvalue = value;
}
ofVertex(0,motionValues.size()*2);
ofVertex(-1,motionValues.size()*2);
ofEndShape();
ofPopMatrix();
}
ofPopMatrix();
for(int i = 0; i<vertMotionSamples.size(); i++) {
float sample = vertMotionSamples[i];
ofSetColor(ofMap(sample, 0, 255,0,255,true));
if(sample<motionTargetThreshold) ofSetColor(50,0,0);
ofNoFill();
float ypos = ofMap(i, 0, vertMotionSamples.size(), area.getTop(), area.getBottom());
ofCircle(pos.x, ypos, 3);
ofRect(pos.x - (multiSampleSize/2), ypos-(multiSampleSize/2), multiSampleSize, multiSampleSize);
}
ofPopStyle();
} else if(sampleBrightness>0) {
ofPushStyle();
for(int i = 0; i<vertMotionSamples.size(); i++) {
// ofSetColor(ofMap(sample, 0, 255,0,255,true));
//if(sample<motionTargetThreshold) ofSetColor(50,0,0);
ofNoFill();
//.........这里部分代码省略.........