void Creature::drawOutfit(const Rect& destRect, bool resize) { int exactSize; if(m_outfit.getCategory() == ThingCategoryCreature) exactSize = getExactSize(); else exactSize = g_things.rawGetThingType(m_outfit.getAuxId(), m_outfit.getCategory())->getExactSize(); if(g_graphics.canUseFBO()) { const FrameBufferPtr& outfitBuffer = g_framebuffers.getTemporaryFrameBuffer(); outfitBuffer->resize(Size(2*Otc::TILE_PIXELS, 2*Otc::TILE_PIXELS)); outfitBuffer->bind(); g_painter->setAlphaWriting(true); g_painter->clear(Color::alpha); internalDrawOutfit(Point(Otc::TILE_PIXELS,Otc::TILE_PIXELS) + getDisplacement(), 1, false, true, Otc::South); outfitBuffer->release(); Rect srcRect; if(resize) srcRect.resize(exactSize, exactSize); else srcRect.resize(2*Otc::TILE_PIXELS*0.75f, 2*Otc::TILE_PIXELS*0.75f); srcRect.moveBottomRight(Point(2*Otc::TILE_PIXELS - 1, 2*Otc::TILE_PIXELS - 1)); outfitBuffer->draw(destRect, srcRect); } else { float scaleFactor; if(resize) scaleFactor = destRect.width() / (float)exactSize; else scaleFactor = destRect.width() / (float)(2*Otc::TILE_PIXELS*0.75f); Point dest = destRect.bottomRight() - (Point(Otc::TILE_PIXELS,Otc::TILE_PIXELS) - getDisplacement())*scaleFactor; internalDrawOutfit(dest, scaleFactor, false, true, Otc::South); } }
void world_update_state() { xSemaphoreTake(world.update_state_mutex, portMAX_DELAY); // save current encoder data in prev encoder structures xSemaphoreTake(world.encoder_mutex, portMAX_DELAY); copy_encoder(&(world.curr_left), &(world.prev_left)); copy_encoder(&(world.curr_right), &(world.prev_right)); xSemaphoreGive(world.encoder_mutex); // update encoder values world_update_encoder(ODO_CURR_ENCODER_RIGHT); world_update_encoder(ODO_CURR_ENCODER_LEFT); // get displacement based on current tickvalues of encoders State ds = getDisplacement(world.curr_right, world.curr_left, world.prev_right, world.prev_left, world.phi); // update state of the robot xSemaphoreTake(world.state_mutex, portMAX_DELAY); world.phi += ds.phi; if (world.phi < -PI) { world.phi += 2*PI; } if (world.phi > PI) { world.phi += -2*PI; } world.x += ds.x; world.y += ds.y; //UARTprintf("x : %d | y : %d | phi : %d\n", (int) world.x, (int) world.y, (int) (world.phi*1000)); xSemaphoreGive(world.state_mutex); xSemaphoreGive(world.update_state_mutex); }
//------------------------------------------------------------------------------ // draw() //------------------------------------------------------------------------------ void BearingPointer::draw() { bool c = isCentered(); LCreal dis = getDisplacement(); lcSaveMatrix(); if (!c) lcTranslate(0, dis); lcRotate(myRotation); BasicGL::Graphic::draw(); lcRestoreMatrix(); }
void Creature::draw(const Point& dest, float scaleFactor, bool animate) { Point animationOffset = animate ? m_walkOffset : Point(0,0); if(m_showTimedSquare && animate) { g_painter->setColor(m_timedSquareColor); g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement() + 2)*scaleFactor, Size(28, 28)*scaleFactor), std::max((int)(2*scaleFactor), 1)); g_painter->setColor(Color::white); } if(m_showStaticSquare && animate) { g_painter->setColor(m_staticSquareColor); g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement())*scaleFactor, Size(Otc::TILE_PIXELS, Otc::TILE_PIXELS)*scaleFactor), std::max((int)(2*scaleFactor), 1)); g_painter->setColor(Color::white); } internalDrawOutfit(dest + animationOffset * scaleFactor, scaleFactor, animate, animate, m_direction); m_footStepDrawn = true; }
void Thing::internalDraw(const Point& dest, float scaleFactor, int w, int h, int xPattern, int yPattern, int zPattern, int layer, int animationPhase) { int scaledSize = Otc::TILE_PIXELS * scaleFactor; int spriteId = getSpriteId(w, h, layer, xPattern, yPattern, zPattern, animationPhase); if(spriteId) { Rect drawRect(dest - getDisplacement()*scaleFactor, Size(scaledSize, scaledSize)); g_painter->setColor(Color::white); g_painter->drawTexturedRect(drawRect, g_sprites.getSpriteTexture(spriteId)); } }
void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView) { if(!canBeSeen()) return; Point animationOffset = animate ? m_walkOffset : Point(0,0); if(m_showTimedSquare && animate) { g_painter->setColor(m_timedSquareColor); g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement() + 2)*scaleFactor, Size(28, 28)*scaleFactor), std::max<int>((int)(2*scaleFactor), 1)); g_painter->setColor(Color::white); } if(m_showStaticSquare && animate) { g_painter->setColor(m_staticSquareColor); g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement())*scaleFactor, Size(Otc::TILE_PIXELS, Otc::TILE_PIXELS)*scaleFactor), std::max<int>((int)(2*scaleFactor), 1)); g_painter->setColor(Color::white); } internalDrawOutfit(dest + animationOffset * scaleFactor, scaleFactor, animate, animate, m_direction); m_footStepDrawn = true; if(lightView) { Light light = rawGetThingType()->getLight(); if(m_light.intensity != light.intensity || m_light.color != light.color) light = m_light; // local player always have a minimum light in complete darkness if(isLocalPlayer() && (g_map.getLight().intensity < 64 || m_position.z > Otc::SEA_FLOOR)) { light.intensity = std::max<uint8>(light.intensity, 3); if(light.color == 0 || light.color > 215) light.color = 215; } if(light.intensity > 0) lightView->addLightSource(dest + (animationOffset + Point(16,16)) * scaleFactor, scaleFactor, light); } }
//------------------------------------------------------------------------------ // converts screen to lat/lon coordinates //------------------------------------------------------------------------------ bool MapPage::screen2LatLon(const LCreal x, const LCreal y, double* const lat, double* const lon) const { bool ok = false; const double scale = getScale(); const double cosLat = getCosRefLat(); if (lat != nullptr && lon != nullptr && scale != 0 && cosLat != 0) { // buffer the inputs double screenX = x; double screenY = y; // Adjust for the decentered displayment if ( !getCentered() ) screenY -= getDisplacement(); // Scale from screen (inches) to A/C (NM) and // transpose the X and Y from screen to A/C const double acX = screenY/scale; const double acY = screenX/scale; // Rotate A/C to NED double earthX = 0.0; double earthY = 0.0; if (getNorthUp()) { earthX = acX; earthY = acY; } else { earthX = (acX * headingCos) - (acY * headingSin); earthY = (acX * headingSin) + (acY * headingCos); } // Convert nautical miles (NED) from ref point to lat/lon *lat = (earthX/60.0) + getReferenceLatDeg(); *lon = (earthY/(60.0*cosLat)) + getReferenceLonDeg(); ok = true; } return ok; }
//------------------------------------------------------------------------------ // converts lat/lon to screen coordinates //------------------------------------------------------------------------------ bool MapPage::latLon2Screen(const double lat, const double lon, LCreal* const x, LCreal* const y) const { bool ok = false; if (x != nullptr && y != nullptr) { // Convert to nautical miles (NED) centered on ownship const double earthX = ((lat - getReferenceLatDeg()) * 60.0); const double earthY = ((lon - getReferenceLonDeg()) * 60.0 * getCosRefLat()); // Rotate to aircraft coordinates double acX = 0; double acY = 0; if (getNorthUp()) { acX = earthX; acY = earthY; } else { acX = (earthX * headingCos) + (earthY * headingSin); acY = -(earthX * headingSin) + (earthY * headingCos); } // Scale from nautical miles to inches and // transpose the X and Y from A/C to screen double screenY = acX * getScale(); const double screenX = acY * getScale(); // Adjust for the decentered displayment if ( !getCentered() ) screenY += getDisplacement(); *x = static_cast<LCreal>(screenX); *y = static_cast<LCreal>(screenY); ok = true; } return ok; }
/*! Assumes a linear spring with the rest value at the joint minimum */ double Joint::getSpringForce() const { return mK * getDisplacement(); }
// ----------------------------------------------------------------------- // drawMap() - Called from draw fun, it tells our specific map to draw. // ----------------------------------------------------------------------- void MapDrawer::drawMap(const int zone, const int idx) { if (myMap != 0 && pagers[idx] != 0 && showMap && getDisplay() != 0){ // Update the tiles for the pager pagers[idx]->updateTextures(textureRow[idx], textureCol[idx]); // Set up for drawing lcColor3(mapIntensity, mapIntensity, mapIntensity); glPushMatrix(); // Not centered, move the whole map down the displacement value. if (!getCentered()) { LCreal dis = getOuterRadius(); //LCreal scale = getScale(); LCreal myScale = vpHL / dis; glTranslatef(0, GLfloat(getDisplacement() * myScale), 0); } glTranslatef(0, 0, -0.1f); sinAng = 0.0f; cosAng = 1.0f; // Set the scale, if not the CENTER_PAGER if (idx != CENTER_PAGER) determineScaling(idx); bool nu = getNorthUp(); if (!nu) { GLfloat hdg = (GLfloat) getHeadingDeg(); glRotatef(hdg, 0.0f, 0.0f, 1.0f); sinAng = (LCreal)lcSin(hdg * (LCreal)Basic::Angle::D2RCC); cosAng = (LCreal)lcCos(hdg * (LCreal)Basic::Angle::D2RCC); } // Translate down the pixels first float transPixelX = -pixelCol[idx] * scalingEast[idx]; float transPixelY = pixelRow[idx] * scalingNorth[idx]; // Translate to the next tile glTranslatef(transPixelX, transPixelY, 0.0f); TextureTable& tbl = pagers[idx]->getTable(); int si = tbl.getLowerBoundIndex(); int i1 = si; int i = 0; int lb = 0, ub = 0; // Enable texturing glEnable(GL_TEXTURE_2D); lb = tbl.getLowerBoundIndex(); ub = tbl.getUpperBoundIndex(); for (i = lb; i <= ub; i++) { int j1 = si; for (int j = lb; j <= ub; j++) { drawTexture(i1, j1, idx); j1++; } i1++; } glDisable(GL_TEXTURE_2D); // Done drawing tiles, now draw grid, if selected to draw. if (drawGrid) { i1 = si; for (i = lb; i <= ub; i++) { int j1 = si; for (int j = lb; j <= ub; j++) { goDrawGrid(i1, j1, idx); j1++; } i1++; } } glPopMatrix(); } }
/*! Get the robot articular displacement since the last call of this method. \param d The measured articular displacement. The dimension of d is 2 (the number of axis of the robot) with respectively d[0] (pan displacement), d[1] (tilt displacement) \sa getDisplacement(), getCameraDisplacement() */ void vpRobotPtu46::getArticularDisplacement(vpColVector &d) { getDisplacement(vpRobot::ARTICULAR_FRAME, d); }
/*! Get the robot displacement expressed in the camera frame since the last call of this method. \param v The measured displacement in camera frame. The dimension of v is 6 (tx, ty, ty, rx, ry, rz). Translations are expressed in meters, rotations in radians. \sa getDisplacement(), getArticularDisplacement() */ void vpRobotPtu46::getCameraDisplacement(vpColVector &v) { getDisplacement(vpRobot::CAMERA_FRAME, v); }
//------------------------------------------------------------------------------ // draw() - draw the objects in their proper place //------------------------------------------------------------------------------ void SymbolLoader::draw() { if (isVisible()) { // Y Displacement (ie, decentered) LCreal displacement = 0; if (!getCentered()) displacement = getDisplacement(); // Radius (ie., range) LCreal radius = 0; if (!getCentered()) radius = getOuterRadiusDC(); else radius = getOuterRadius(); LCreal radius2 = radius * radius; // --- // Setup the drawing parameters for all of our symbols ... // --- for (int i = 0; i < MAX_SYMBOLS; i++) { if (symbols[i] != 0) { // When the symbol visibility flag is true ... if (symbols[i]->isVisible()) { // Get the pointer to the symbol's graphical component Basic::Pair* p = symbols[i]->getSymbolPair(); BasicGL::Graphic* g = (BasicGL::Graphic*)p->object(); // We need the symbol's position in screen coordinates (inches) ... LCreal xScn = (LCreal) symbols[i]->getScreenXPos(); LCreal yScn = (LCreal) symbols[i]->getScreenYPos(); if ( !(symbols[i]->isPositionScreen()) ) { // But when we were not give screen coordinates, // we'll need to compute them from A/C coordinates LCreal acX = 0.0; LCreal acY = 0.0; // 1) when given A/C coordinates ... if ( symbols[i]->isPositionAC() ) { acX = (LCreal) symbols[i]->getXPosition(); acY = (LCreal) symbols[i]->getYPosition(); } // 2) when given NED or L/L coordinates .. else { LCreal north = 0; LCreal east = 0; if (symbols[i]->isPositionLL()) { // 2a) we were give L/L so convert to NED coordinates double lat = symbols[i]->getXPosition(); double lon = symbols[i]->getYPosition(); latLon2Earth(lat, lon, &north, &east); } else { // 2b) we were give NED coordinates north = (LCreal) symbols[i]->getXPosition(); east = (LCreal) symbols[i]->getYPosition(); } // 2c) convert the NED coordinates to aircraft coordinates earth2Aircraft(north, east, &acX, &acY); } // 3) Convert the aircraft coordinates to screen coordinates aircraft2Screen(acX, acY, &xScn, &yScn); // 4) Save the screen coordinates (inches) symbols[i]->setXScreenPos(xScn); symbols[i]->setYScreenPos(yScn); } // In range? Do we care? bool inRange = !showInRangeOnly || (((xScn * xScn) + (yScn * yScn)) <= radius2); if (inRange) { // set symbol's visibility g->setVisibility(true); // and set the symbol's position g->lcSaveMatrix(); g->lcTranslate(xScn, yScn + displacement); // pass the argument value to the symbol (if needed) if (symbols[i]->getValue() != 0) { g->event(UPDATE_VALUE, symbols[i]->getValue()); } // rotate the symbol's heading subcomponent (if needed) // -- sending a 'Z' rotation event to a component named 'hdg' if (symbols[i]->isHeadingValid()) { BasicGL::Graphic* phdg = symbols[i]->getHdgGraphics(); if (phdg == 0) { Basic::Pair* hpair = (Basic::Pair*) g->findByName("hdg"); if (hpair != 0) { phdg = dynamic_cast<Graphic*>(hpair->object()); symbols[i]->setHdgGraphics(phdg); } } if (phdg != 0) { Basic::Degrees* angObj = symbols[i]->getHdgAngleObj(); if (angObj == 0) { angObj = new Basic::Degrees(); symbols[i]->setHdgAngleObj(angObj); } double relHeading = symbols[i]->getHeadingDeg() - getHeadingDeg(); angObj->set(-relHeading); phdg->event(UPDATE_VALUE6, angObj); } } } else { // out of range, so clear the graphical component's visibility flag g->setVisibility(false); } } // When the symbol visibility flag is false ... else { Basic::Pair* p = symbols[i]->getSymbolPair(); BasicGL::Graphic* g = (BasicGL::Graphic*)p->object(); g->setVisibility(false); } } } // --- // Let our base class handle the drawing // --- BaseClass::draw(); // --- // now restore the matrices on all of our graphical components // --- for (int i = 0; i < MAX_SYMBOLS; i++) { if (symbols[i] != 0) { Basic::Pair* p = symbols[i]->getSymbolPair(); BasicGL::Graphic* g = (BasicGL::Graphic*)p->object(); if (g->isVisible()) g->lcRestoreMatrix(); } } } }
/*! Get the robot displacement expressed in the camera frame since the last call of this method. \param d The measured displacement in camera frame. The dimension of d is 6 (tx, ty, ty, rx, ry, rz). Translations are expressed in meters, rotations in radians. \sa getDisplacement(), getArticularDisplacement() */ void vpRobotBiclops::getCameraDisplacement(vpColVector &d) { getDisplacement(vpRobot::CAMERA_FRAME, d); }
sf::Vector2f Camera::screenPositionToGamePosition(const int x, const int y) const { return sf::Vector2f(x*mScalingFactor.x, y*mScalingFactor.y) + getDisplacement(); }
void MRFRegistration2DParametersWidget::startRegistration() { /* ///////////////////////////////////////////////////////////////// // Get the values of the parameters out of the controls // and then emit the signal and close the box ////////////////////////////////////////////////////////////////// ParameterSet params; params.gridSpacing = this->spacingValue->value(); params.labelInc = this->labelIncValue->value(); params.labelSteps = this->labelStepsValue->value(); params.maxDisplacement = this->maxDisplacementValue->value(); params.optimiserIterations = this->optimiserIterationsValue->value(); params.regularisationAmount = this->regularisationValue->value(); params.resolutionLevels = this->multiResultionValue->value(); params.useSparseSampling = this->useSparseSampling->isChecked(); params.xGridOrigin = this->xOriginValue->value(); params.xGridSize = this->xSizeValue->value(); params.yGridOrigin = this->yOriginValue->value(); params.yGridSize = this->ySizeValue->value(); params.metricType = this->metricValue->currentIndex(); */ // do some sanity checking // // // if(this->fixedImageSelector->currentIndex() == 0) { QMessageBox box; box.setText(tr("No fixed Image Set")); box.exec(); return; } if(this->movingImageSelector->currentIndex() == 0) { QMessageBox box; box.setText(tr("No moving Image Set")); box.exec(); return; } if(this->movingImageSelector->currentIndex() == this->fixedImageSelector->currentIndex()) { QMessageBox box; box.setText(tr("Fixed and Moving are the same... pretty pointless")); box.exec(); return; } // create the data nodes to pass to the reg display // // // mitk::DataNode::Pointer fixedNode = mitk::DataNode::New(); fixedNode->SetData(this->imageHolder[this->fixedImageSelector->currentIndex()-1]); mitk::DataNode::Pointer movingNode = mitk::DataNode::New(); movingNode->SetData(this->imageHolder[this->movingImageSelector->currentIndex()-1]); MRFRegistration2DDisplayWidget * regDisplay = new MRFRegistration2DDisplayWidget(this); regDisplay->setFixedImage(fixedNode); regDisplay->setMovingImage(movingNode); regDisplay->setXGridOrigin(this->xOriginValue->value()); regDisplay->setYGridOrigin(this->yOriginValue->value()); regDisplay->setXGridSize(this->xSizeValue->value()); regDisplay->setYGridSize(this->ySizeValue->value()); regDisplay->setGridSpacing(this->spacingValue->value()); regDisplay->setLabelSteps(this->labelStepsValue->value()); regDisplay->setLabelInc(this->labelIncValue->value()); regDisplay->setOptimiserIterations(this->optimiserIterationsValue->value()); regDisplay->setUseSparseSampling(this->useSparseSampling->isChecked()); regDisplay->setResolutionLevels(this->multiResultionValue->value()); regDisplay->initialise(); // connect the output connect(regDisplay, SIGNAL(registrationFinished(mitk::DataNode::Pointer)), this, SLOT(getDisplacement(mitk::DataNode::Pointer))); regDisplay->show(); //emit sendData(params); }
IRWItem<double> * BrownianMotion::getDisplacementItem(int partp){ IRWItem<double> * ret = new RWDp<double>(); QVector<double> temp= getDisplacement(partp); ret->receiveData(temp.data(),temp.size()); return ret; }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void Processor::flush() { size_t n = _samplePool.size(); double *data = _samplePool.samples; bool clipped = false; // Skip empty sample pool if ( n == 0 ) return; // ------------------------------------------------------------------- // Saturation check // ------------------------------------------------------------------- if ( _config.saturationThreshold >= 0 ) { double maxCounts = (_config.saturationThreshold * 0.01) * (2 << 23); for ( size_t i = 0; i < n; ++i ) { if ( fabs(data[i]) > maxCounts ) clipped = true; } } // ------------------------------------------------------------------- // Sensitivity correction // ------------------------------------------------------------------- double scorr = 1.0 / _streamConfig[_usedComponent].gain; for ( size_t i = 0; i < n; ++i ) data[i] *= scorr; // ------------------------------------------------------------------- // Baseline correction and filtering // ------------------------------------------------------------------- double amp0 = getValue(n, data, NULL, _baselineCorrection0, _filter0.get()); // ------------------------------------------------------------------- // Conversion to ACC, VEL, DISP // ------------------------------------------------------------------- SignalUnit unit; if ( !unit.fromString(_streamConfig[_usedComponent].gainUnit.c_str()) ) { SEISCOMP_ERROR("%s: internal error: invalid gain unit '%s'", Private::toStreamID(_waveformID).c_str(), _streamConfig[_usedComponent].gainUnit.c_str()); return; } double vel, acc, disp; std::vector<double> tmp; double *vel_data; switch ( unit ) { case MeterPerSecond: vel = amp0; tmp.assign(data, data+n); vel_data = &tmp[0]; acc = getAcceleration(n, data); break; case MeterPerSecondSquared: acc = amp0; vel = getVelocity(n, data); vel_data = data; break; default: SEISCOMP_ERROR("%s: internal error: unsupported gain unit '%s'", Private::toStreamID(_waveformID).c_str(), _streamConfig[_usedComponent].gainUnit.c_str()); return; } disp = getDisplacement(n, vel_data); // Publish result if ( _func ) _func(this, acc, vel, disp, _currentStartTime, clipped); _samplePool.clear(); }
void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction) { // outfit is a real creature if(m_outfit.getCategory() == ThingCategoryCreature) { int animationPhase = animateWalk ? m_walkAnimationPhase : 0; if(isAnimateAlways() && animateIdle) { int ticksPerFrame = 1000 / getAnimationPhases(); animationPhase = (g_clock.millis() % (ticksPerFrame * getAnimationPhases())) / ticksPerFrame; } // xPattern => creature direction int xPattern; if(direction == Otc::NorthEast || direction == Otc::SouthEast) xPattern = Otc::East; else if(direction == Otc::NorthWest || direction == Otc::SouthWest) xPattern = Otc::West; else xPattern = direction; int zPattern = 0; if(m_outfit.getMount() != 0) { auto datType = g_things.rawGetThingType(m_outfit.getMount(), ThingCategoryCreature); dest -= datType->getDisplacement() * scaleFactor; datType->draw(dest, scaleFactor, 0, xPattern, 0, 0, animationPhase); dest += getDisplacement() * scaleFactor; zPattern = 1; } // yPattern => creature addon for(int yPattern = 0; yPattern < getNumPatternY(); yPattern++) { // continue if we dont have this addon if(yPattern > 0 && !(m_outfit.getAddons() & (1 << (yPattern-1)))) continue; auto datType = rawGetThingType(); datType->draw(dest, scaleFactor, 0, xPattern, yPattern, zPattern, animationPhase); if(getLayers() > 1) { Color oldColor = g_painter->getColor(); Painter::CompositionMode oldComposition = g_painter->getCompositionMode(); g_painter->setCompositionMode(Painter::CompositionMode_Multiply); g_painter->setColor(m_outfit.getHeadColor()); datType->draw(dest, scaleFactor, SpriteMaskYellow, xPattern, yPattern, zPattern, animationPhase); g_painter->setColor(m_outfit.getBodyColor()); datType->draw(dest, scaleFactor, SpriteMaskRed, xPattern, yPattern, zPattern, animationPhase); g_painter->setColor(m_outfit.getLegsColor()); datType->draw(dest, scaleFactor, SpriteMaskGreen, xPattern, yPattern, zPattern, animationPhase); g_painter->setColor(m_outfit.getFeetColor()); datType->draw(dest, scaleFactor, SpriteMaskBlue, xPattern, yPattern, zPattern, animationPhase); g_painter->setColor(oldColor); g_painter->setCompositionMode(oldComposition); } } // outfit is a creature imitating an item or the invisible effect } else { ThingType *type = g_things.rawGetThingType(m_outfit.getAuxId(), m_outfit.getCategory()); int animationPhase = 0; int animationPhases = type->getAnimationPhases(); int animateTicks = Otc::ITEM_TICKS_PER_FRAME; // when creature is an effect we cant render the first and last animation phase, // instead we should loop in the phases between if(m_outfit.getCategory() == ThingCategoryEffect) { animationPhases = std::max(1, animationPhases-2); animateTicks = Otc::INVISIBLE_TICKS_PER_FRAME; } if(animationPhases > 1) { if(animateIdle) animationPhase = (g_clock.millis() % (animateTicks * animationPhases)) / animateTicks; else animationPhase = animationPhases-1; } if(m_outfit.getCategory() == ThingCategoryEffect) animationPhase = std::min(animationPhase+1, animationPhases); type->draw(dest - (getDisplacement() * scaleFactor), scaleFactor, 0, 0, 0, 0, animationPhase); } }
/*! Get the robot displacement (frame has to be specified). \param frame : Control frame. For the moment, only vpRobot::REFERENCE_FRAME is implemented. \param dis : A 6 dimension vector that corresponds to the displacement of the robot since the last call to the function. \exception vpRobotException::wrongStateError : If the specified control frame is not supported. */ void vpROSRobot::getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &dis){ struct timespec timestamp; getDisplacement(frame, dis, timestamp); }