本文整理汇总了C++中ofRectangle::getLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ ofRectangle::getLeft方法的具体用法?C++ ofRectangle::getLeft怎么用?C++ ofRectangle::getLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofRectangle
的用法示例。
在下文中一共展示了ofRectangle::getLeft方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawVertAlignMark
//--------------------------------------------------------------
void testApp::drawVertAlignMark(const ofRectangle& rect, const ofColor& color, ofAlignVert vAlign) {
if(vAlign != OF_ALIGN_VERT_IGNORE) {
float vAnchor = rect.getVertAnchor(vAlign);
ofSetColor(color,120);
ofLine(rect.getLeft() - 13, vAnchor, rect.getLeft() - 3, vAnchor);
ofLine(rect.getRight() + 13, vAnchor, rect.getRight() + 3, vAnchor);
}
}
示例2: distributeHorz
void RectangleUtils::distributeHorz(RectanglePointers& rects,
const ofRectangle& boundingRect,
ofAlignHorz horzAnchor)
{
if(rects.size() >= 3 && horzAnchor != OF_ALIGN_HORZ_IGNORE) {
sortByHorzAnchor(rects,horzAnchor);
float nPos = rects.size() - 1;
// adjust to bounding bounding rect. if bounding rect is based on the group, nothing will change
rects[0]->translateX(boundingRect.getLeft() - rects[0]->getLeft());
rects[nPos]->translateX(boundingRect.getRight() - rects[nPos]->getRight());
float leftX = rects[0]->getHorzAnchor(horzAnchor);
float rightX = rects[nPos]->getHorzAnchor(horzAnchor);
float span = ( rightX - leftX ) / ( nPos );
for(size_t i = 1; i < nPos; i++) {
rects[i]->translateX((leftX - rects[i]->getHorzAnchor(horzAnchor)) + i * span);
}
} else {
if(horzAnchor == OF_ALIGN_HORZ_IGNORE) {
ofLogVerbose("ofDistributeHorizontal") << "OF_ALIGN_HORZ_IGNORE distribute requested, ignoring.";
} else {
ofLogWarning("ofDistributeHorizontal") << "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: update
bool Trigger::update(float deltaTime, ofRectangle& triggerArea) {
this->deltaTime = deltaTime;
elapsedTime+=deltaTime;
if((moving) || ( (elapsedTime-lastTriggerTime > 4) && (rechargeSettings->restoreSpeed>0) && !disabled && (unitPower>=rechargeSettings->triggerPower) )) {
sampleBrightness += deltaTime;
} else {
sampleBrightness-=deltaTime*2;
}
sampleBrightness = ofClamp(sampleBrightness, 0, 1);
moving = false;
if(lastSettings!=NULL) {
lastScale-=deltaTime*5;
if(lastScale<=0.0) {
lastScale = 0;
lastSettings = NULL;
}
}
// scale up / down on start stop
if(stopping) {
scale-=deltaTime*5;
if(scale<=0.0) {
scale = 0;
active = false;
return false;
}
return active;
} else if(scale<1){
scale+= deltaTime*5; // (1-scale)*0.2;
if(scale>1) scale = 1;
}
if((settings!=NULL) &&(!settings->rotateOnFire)) {
angle = 0;
if(settings->rotationSpeed>0) {
float sinoffset = settings->rotateOscillationOffset * ofMap(pos.x, triggerArea.getLeft(), triggerArea.getRight(), -1, 1);
angle = (sin((elapsedTime + sinoffset)*settings->rotationSpeed )*settings->rotationExtent);
}
if(settings->rotateMirrorOffset!=0) {
angle+= ofMap(pos.x, triggerArea.getLeft(), triggerArea.getRight(), 1, -1) * settings->rotateMirrorOffset;
}
}
if(showDebugData) {
if((elapsedTime-lastUpdate>0.032)||(motionValues.size()==0)) {
motionValues.push_back(motionLevel);
lastUpdate = elapsedTime;
} else {
float lastlevel = 0;
lastlevel = motionValues[motionValues.size()-1];
motionValues[motionValues.size()-1] = (motionLevel>lastlevel) ? motionLevel : lastlevel;
}
if(motionValues.size()>motionValueCount) {
motionValues.pop_front();
}
}
unitPower+=rechargeSettings->restoreSpeed * deltaTime;
if(unitPower>1) unitPower = 1;
if((rechargeSettings->restoreSpeed==0) && (unitPower<=0)) {
stopping = true;
}
// we need to have sensed motion,
// AND we need to have enough unitPower to trigger
if( (!disabled) && (!stopping) &&
(scale>0.95) &&
(motionLevel >= rechargeSettings->motionTriggerLevel) &&
(unitPower>=rechargeSettings->triggerPower) &&
(elapsedTime - lastTriggerTime > rechargeSettings->minTriggerInterval) ) {
//.........这里部分代码省略.........