void Gate::open() { if (!_opened && lastFrame()) { setFrameLine(OPEN_LINE); _opened = true; _damageable = false; } }
bool LibVision::computeSubRect(std::vector<cv::Point> candidate, cv::Mat &roi) { const float _SIDE_PLUS = 0; const float _SIDE_PLUS_2 = 0; const float _MIN_X = _SIDE_PLUS; const float _MAX_X = lastFrame.cols - _SIDE_PLUS; const float _MIN_Y = _SIDE_PLUS; const float _MAX_Y = lastFrame.rows - _SIDE_PLUS; int xMin = 0, xMax = 0, yMin = 0, yMax = 0; float x_corners[candidate.size()]; float y_corners[candidate.size()]; for (size_t c = 0; c < candidate.size(); c++) { x_corners[c] = candidate[c].x; y_corners[c] = candidate[c].y; } std::qsort(y_corners, 4, sizeof(int), LibVision::compare); std::qsort(x_corners, 4, sizeof(int), LibVision::compare); xMin = x_corners[0] - _SIDE_PLUS_2; xMax = x_corners[3] + _SIDE_PLUS_2; yMin = y_corners[0] - _SIDE_PLUS_2; yMax = y_corners[3] + _SIDE_PLUS_2; if (xMin > _MIN_X && xMax < _MAX_X && yMin > _MIN_Y && yMax < _MAX_Y) { if (xMax < xMin || yMax < yMin) { std::cout << "Error in subrect" << std::endl; return false; } cv::Mat roiD = lastFrame(cv::Rect(xMin, yMin, xMax - xMin, yMax - yMin)); roiD.copyTo(roi); return true; } return false; }
void Gate::close() { if (_opened && lastFrame() && (_HP >= 0)) { setFrameLine(CLOSE_LINE); _opened = false; _damageable = true; _barrier = true; } }
void Gate::update() { if (_HP < 0) open(); if (!lastFrame()) CombinedAnimation::update(); else _barrier = !_opened; }
BRect TElementsSorter::GetScrollArea() { BRect firstFrame(0,0,0,0); BRect lastFrame(0,0,0,0); BRect bounds = Bounds(); // Get first sorter in list TSorterContainer* firstSorter = static_cast<TSorterContainer*>(fSorterList->FirstItem() ); firstFrame = firstSorter->Frame(); // Get last sorter in list TSorterContainer* lastSorter = static_cast<TSorterContainer*>(fSorterList->ItemAt( fSorterList->CountItems() - 1) ); if (lastSorter) lastFrame = lastSorter->Frame(); bounds.left = firstFrame.left; bounds.right = lastFrame.right; return bounds; }
void Tube::buildPTF() { mFrames.clear(); int n = mPs.size(); // Make sure we have at least 3 points because the first frame requires it if( n >= 3 ) { mFrames.resize( n ); // Make the parallel transport frame mFrames[0] = firstFrame( mPs[0], mPs[1], mPs[2] ); // Make the remaining frames - saving the last for( int i = 1; i < n - 1; ++i ) { Vec3f prevT = mTs[i - 1]; Vec3f curT = mTs[i]; mFrames[i] = nextFrame( mFrames[i - 1], mPs[i - 1], mPs[i], prevT, curT ); } // Make the last frame mFrames[n - 1] = lastFrame( mFrames[n - 2], mPs[n - 2], mPs[n - 1] ); } }
ICPWidget::ICPWidget(QWidget *parent) : QFrame(parent), ui(new Ui::ICPWidget) { ui->setupUi(this); v.initCameraParameters(); v.setBackgroundColor(1.0,1.0,1.0); v.addCoordinateSystem(0.3); v.registerPointPickingCallback<ICPWidget>(&ICPWidget::pick,*this,NULL); v.registerKeyboardCallback<ICPWidget>(&ICPWidget::key,*this,NULL); widget.SetRenderWindow(v.getRenderWindow()); ui->frameView->layout()->addWidget(&widget); ui->tools->setCurrentIndex(0); QString dataInfo; Pipe::loadData(_FrameKeyList,dataInfo,Pipe::_FrameListKey); Pipe::loadData(_IdMapKeyList,dataInfo,Pipe::_IdMapListKey); frameCloud = FullPointCloud::Ptr(new FullPointCloud); segCloud = FullPointCloud::Ptr(new FullPointCloud); currentFrame = 0; currentState = PICK_FRAME; currentObjIndex = -1; connect(ui->nextFrame,SIGNAL(clicked()),this,SLOT(nextFrame())); connect(ui->lastFrame,SIGNAL(clicked()),this,SLOT(lastFrame())); connect(ui->loadFrame,SIGNAL(clicked()),this,SLOT(reLoadFrameWithView())); connect(ui->addObj,SIGNAL(clicked()),this,SLOT(addObj())); connect(ui->delObj,SIGNAL(clicked()),this,SLOT(delObj())); connect(ui->icpObj,SIGNAL(clicked()),this,SLOT(icpObj())); connect(ui->tools,SIGNAL(currentChanged(int)),this,SLOT(changeState(int))); connect(ui->outObj,SIGNAL(clicked()),this,SLOT(outputObj())); connect(ui->outFrame,SIGNAL(clicked()),this,SLOT(outputFrame())); }
void FMGlyphHighlight::animate(int frame) { // qDebug()<<"ANIM"<<frame; if(frame == maxFrame) { lastFrame(); return; } // pos // double shift((double)frame/20.0); // m_rect->setPos(initialPos.x() + shift, initialPos.y()+shift); // // // scalelyphhighlight.h // double scale(frame / maxFrame); // QMatrix mat; // mat.scale(scale,scale); // m_rect->setMatrix(mat); // // color QColor c(0,0,0, 255 - ( (frame * 255)/maxFrame ) ); // QColor c(255,0,0,255); m_rect->setBrush(QBrush(c)); m_rect->setPen(QPen(c)); }
void EvilFish::advance() { if (_state == kStateNone) return; bool wasLastFrame = lastFrame(); int16 oldX, oldY; getPosition(oldX, oldY); ANIObject::advance(); int16 x, y, width, height; getFramePosition(x, y); getFrameSize(width, height); switch (_state) { case kStateNone: break; case kStateSwimLeft: if (!_shouldLeave && (x >= _screenWidth - width)) { setAnimation(_animTurnRight); setPosition(x, oldY); _state = kStateTurnRight; } if (_shouldLeave && (x >= _screenWidth)) { setVisible(false); _shouldLeave = false; _state = kStateNone; } break; case kStateSwimRight: if (!_shouldLeave && (x <= 0)) { setAnimation(_animTurnLeft); setPosition(x, oldY); _state = kStateTurnLeft; } if (_shouldLeave && (x < -width)) { setVisible(false); _shouldLeave = false; _state = kStateNone; } break; case kStateTurnLeft: if (wasLastFrame) { setAnimation(_animSwimLeft); _state = kStateSwimLeft; } break; case kStateTurnRight: if (wasLastFrame) { setAnimation(_animSwimRight); _state = kStateSwimRight; } break; case kStateDie: if (wasLastFrame) { setVisible(false); _state = kStateNone; } break; } }
CelsRange Sprite::uniqueCels() const { return CelsRange(this, frame_t(0), lastFrame(), CelsRange::UNIQUE); }
CelsRange Sprite::cels() const { return CelsRange(this, frame_t(0), lastFrame()); }