uint8_t Arrows::animate(COLOUR *arrayP, uint8_t fadeIn, uint8_t fadeOut, BUCK startBuck){ if(fadeIn){ begin(); memset(arrayP, 0, SIZE3*sizeof(COLOUR)); array_pointer = arrayP; } this_fadeOut = fadeOut; memset(arrayP, 0, SIZE3*sizeof(COLOUR)); memset(ORArray, 0, 28*3*sizeof(uint8_t)); arrow(0); arrow(1); arrow(2); if(!fadeInDone){ (startup[startArrow]<8)?startup[startArrow]++:8; }else if(fadeOut){ (startup[startArrow]>0)?startup[startArrow]--:0; } increment_colour_pos(2); return fadeOutDone; }
void CEasyLock::_lock() { if (_showActivity) { std::string arrow("... "); if (VThread::isUiThreadIdSet()) { if (VThread::isCurrentThreadTheUiThread()) arrow+="(GUI) ("; else arrow+="(SIM) ("; } else arrow+="(GUI) ("; CDebugLogFile::addDebugText(false,arrow.c_str(),_functionName.c_str(),") 'easy unlocking'\n"); } _mutex->lock(); if (_showActivity) { std::string arrow("... "); if (VThread::isUiThreadIdSet()) { if (VThread::isCurrentThreadTheUiThread()) arrow+="(GUI) ("; else arrow+="(SIM) ("; } else arrow+="(GUI) ("; CDebugLogFile::addDebugText(false,arrow.c_str(),_functionName.c_str(),") 'easy unlocked'\n"); } }
/*! \brief Sets up the vertex buffer objects for the axis. */ inline void init() { ///////////////////Vertex Data // three arrows, consisting of 3 lines each (6 vertices std::vector<GLfloat> vertexdata(18 * 3); float arrowHeadDepth = 0.25f; float arrowHeadWidth = 0.15f; for (size_t arrow(0); arrow < 3; ++arrow) { //Ordinate -> for (size_t i(0); i < 3; ++i) vertexdata[(6 * arrow + 0) * 3 + i] = -0.5f; //-> Head for (size_t i(0); i < 3; ++i) vertexdata[(6 * arrow + 1) * 3 + i] = -0.5f; vertexdata[(6 * arrow + 1) * 3 + arrow] = 0.5f; //Head -> for (size_t i(0); i < 3; ++i) vertexdata[(6 * arrow + 2) * 3 + i] = -0.5f; vertexdata[(6 * arrow + 2) * 3 + arrow] = 0.5f; //-> Left point vertexdata[(6 * arrow + 3) * 3 + arrow] = 0.5f - arrowHeadDepth; vertexdata[(6 * arrow + 3) * 3 + ((arrow + 1) % 3)] = -0.5f + arrowHeadWidth; vertexdata[(6 * arrow + 3) * 3 + ((arrow + 2) % 3)] = -0.5f; //Head -> for (size_t i(0); i < 3; ++i) vertexdata[(6 * arrow + 4) * 3 + i] = -0.5f; vertexdata[(6 * arrow + 4) * 3 + arrow] = 0.5f; //-> Right point vertexdata[(6 * arrow + 5) * 3 + arrow] = 0.5f - arrowHeadDepth; vertexdata[(6 * arrow + 5) * 3 + ((arrow + 1) % 3)] = -0.5f - arrowHeadWidth; vertexdata[(6 * arrow + 5) * 3 + ((arrow + 2) % 3)] = -0.5f; } _vertexData.init(vertexdata); ///////////////////Color Data std::vector<GLubyte> colordata(18 * 4); //First arrow is red, second green and last blue for (size_t arrow(0); arrow < 3; ++arrow) for (size_t vertex(0); vertex < 6; ++vertex) { colordata[(arrow * 6 + vertex)* 4 + arrow] = 255; colordata[(arrow * 6 + vertex)* 4 + ((arrow + 1) % 3)] = 0; colordata[(arrow * 6 + vertex)* 4 + ((arrow + 2) % 3)] = 0; colordata[(arrow * 6 + vertex)* 4 + 3] = 255; //Alpha channel } _colorData.init(colordata); }
int distrib_arrow(int i, char **result, char *buffer, int *v) { if (*result) i = arrow(i, buffer[2], ft_strlen(*result), result); else i = arrow(i, buffer[2], 0, result); if (buffer[2] != 65 && buffer[2] != 66) *v = 1; return (i); }
void WidgetSessions::showRelated(const qmf::Data& object, const QString &widget_type, ArrowDirection a) { if (!updateAll) if (this->hasData() && (arrow() != arrowNone)) { //qDebug("showRelated: %s needs an update", this->objectName().toStdString().c_str()); emit needUpdate(); return; } setArrow(a); if (widget_type == "widgetConnections") { qpid::types::Variant value = object.getProperty("address"); std::string name = value.asString(); related->setRelatedData("connectionRef", name); related->clearFilter(); emit needData(); return; } // the object is a subscription qpid::types::Variant value = object.getProperty("sessionRef"); QString name(value.asMap()["_object_name"].asString().c_str()); QString session = name.section(':', -1); related->setRelatedData("name", session.toStdString()); related->clearFilter(); //qDebug("showRelated: %s needs new data", this->objectName().toStdString().c_str()); emit needData(); }
void Enemy::shoot() { left = false; right = false; facing_right = player->x > x; int pause_frames = 4; double attspeed = 1/6.0; att += attspeed; if(att > 21+pause_frames-attspeed) { attack = 0; } if(att > pause_frames) frame = 6 + att-pause_frames; else frame = 5; if(att > 13+pause_frames && !fired) { fired = true; double angle = atan2((player->y-player_distance/10)-y, player->x-x) + Game::randomDouble(-0.25,0.25); double vel = 5; std::shared_ptr<Arrow> arrow(new Arrow(world())); arrow->x = x; arrow->y = y; arrow->dx = vel*cos(angle); arrow->dy = vel*sin(angle); arrow->add(); Game::playSound("shoot",shared_from_this()); } }
void testmain() { print("struct"); t1(); t2(); t3(); t4(); t5(); t6(); t7(); t8(); t9(); t10(); t11(); t12(); t13(); t14(); unnamed(); assign(); arrow(); incomplete(); bitfield_basic(); bitfield_mix(); bitfield_union(); bitfield_unnamed(); bitfield_initializer(); test_offsetof(); flexible_member(); empty_struct(); }
// Returns the next token in the character stream. // If no next token can be identified, an error // is emitted and we return the error token. Token Lexer::scan() { // Consume any white space here. space(); switch (peek()) { case 0: return eof(); case '(': return lparen(); case ')': return rparen(); case '-': if (peek(1) == '>') return arrow(); else return error(); default: if (Token tok = identifier()) return tok; else return error(); } }
/* Attend ticks/200 secondes */ void zdelay( long ticks ) { busybee(); evnt.timer = ticks; EvntWindom( MU_TIMER ); arrow(); }
void BattleCommanderStateDirection::SetGuideArrowToGhost(void){ if(_accessor == nullptr){return;} int arrow_index(0); for(int i=0; i<GUIDE_ARROW_MAX; i++){ if(_guide_arrow[i] == nullptr){continue;} _guide_arrow[i]->SetVisible(false); } int player_count(_accessor->GetPlayerCount()); for(int i=0; i<player_count; i++){ BattleActor* player(_accessor->GetPlayer(i)); BattleActorGhost* ghost(_accessor->GetPlayerGhost(player)); ActorCursor* cursor(_accessor->GetPlayerCursor(i)); if(player == nullptr || ghost == nullptr || cursor == nullptr){continue;} if(!cursor->IsActive()){continue;} while(arrow_index < GUIDE_ARROW_MAX && _guide_arrow[arrow_index] == nullptr){ arrow_index++; continue; } if(arrow_index == GUIDE_ARROW_MAX){break;} GuideArrow* arrow(_guide_arrow[arrow_index]); D3DXVECTOR3 begin(player->GetPosition()); D3DXVECTOR3 end(ghost->GetPosition()); arrow->SetBeginPosition(begin); arrow->SetEndPosition(end); arrow->SetVisible(true); arrow->Update(); } }
int main(void) { mpz_t base; mpz_t exponent; mpz_t arrows; mpz_t result; mpz_init(base); mpz_init(exponent); mpz_init(arrows); mpz_init(result); mpz_set_ui(base, 2L); mpz_set_ui(arrows, 2L); mpz_set_ui(exponent, 5L); arrow(result, base, exponent, arrows); gmp_printf("%Zd\n", result); int digit = 0; while (mpz_cmp_ui(result, 1L) >= 0) { digit++; mpz_fdiv_q_ui(result, result, 10UL); } gmp_printf("%d digits\n%", digit); return 0; }
QPointArray QDial::calcArrow( double &a ) const { int r = QMIN( width(), height() ) / 2; if ( maxValue() == minValue() ) a = m_pi / 2; else if ( d->wrapping ) a = m_pi * 3 / 2 - ( value() - minValue() ) * 2 * m_pi / ( maxValue() - minValue() ); else a = ( m_pi * 8 - ( value() - minValue() ) * 10 * m_pi / ( maxValue() - minValue() ) ) / 6; int xc = width() / 2; int yc = height() / 2; int len = r - calcBigLineSize() - 5; if ( len < 5 ) len = 5; int back = len / 4; if ( back < 1 ) back = 1; QPointArray arrow( 3 ); arrow[0] = QPoint( (int)( 0.5 + xc + len * cos(a) ), (int)( 0.5 + yc -len * sin( a ) ) ); arrow[1] = QPoint( (int)( 0.5 + xc + back * cos( a + m_pi * 5 / 6 ) ), (int)( 0.5 + yc - back * sin( a + m_pi * 5 / 6 ) ) ); arrow[2] = QPoint( (int)( 0.5 + xc + back * cos( a - m_pi * 5 / 6 ) ), (int)( 0.5 + yc - back * sin( a - m_pi * 5 / 6 ) ) ); return arrow; }
void MaxFlowVisualizer::drawEdge(const Edge &edge, QPainter &painter) const { QPen pen; pen.setWidth(3); // Ребро, которое считается "допустимым" по алгоритму, выделяем черным. if (relabelToFrontAlgo.getVertexHeight(edge.getFirstVertexIndex()) == relabelToFrontAlgo.getVertexHeight(edge.getSecondVertexIndex()) + 1) { pen.setColor(Qt::black); } else { pen.setColor(Qt::gray); } if (edge.getFlow() != 0) { pen.setColor(Qt::darkBlue); } // Если в последнем действии алгоритма произошло проталкивание по этому ребру, // то выделим его красным. if (lastAlgoAction.getType() == AlgoAction::ACTION_PUSH && lastAlgoAction.getEdgeInfo() == edge) { pen.setColor(Qt::red); } painter.setPen(pen); QPoint pointFrom(verteciesList[edge.getFirstVertexIndex()].getCenterCoordX(), verteciesList[edge.getFirstVertexIndex()].getCenterCoordY()); QPoint pointTo(verteciesList[edge.getSecondVertexIndex()].getCenterCoordX(), verteciesList[edge.getSecondVertexIndex()].getCenterCoordY()); double length = sqrt(pow(pointFrom.x() - pointTo.x(), 2) + pow(pointFrom.y() - pointTo.y(), 2)); long vertexRaduis = verteciesList[edge.getSecondVertexIndex()].getRadius(); QPoint offsetVector((pointFrom.x() - pointTo.x()) * vertexRaduis / length, (pointFrom.y() - pointTo.y()) * vertexRaduis / length); QPoint arrow((pointFrom.x() - pointTo.x()) * 20 / length, (pointFrom.y() - pointTo.y()) * 20 / length); // Рисование стрелки (самих маленьких боковых линий). // Перенесем систему координат в точку конца ребра (ориенированного). // Возьмем маленький отрезок ребра, и нарисуем его, повернув при этом систуму координат // на +30 и -30 градусов соответственно относительно исходного ребра. // Получилась стрелка -> // После этого восстановим систему координат. painter.setPen(pen); painter.drawLine(pointFrom, pointTo); painter.translate(pointTo.x(), pointTo.y()); // Еще нужно отступить от конца ребра на радиус вершины // (т.к. ребро идет от центра к центру). painter.translate(offsetVector.x(), offsetVector.y()); painter.rotate(30); painter.drawLine(QPoint(0, 0), arrow); painter.rotate(-60); painter.drawLine(QPoint(0, 0), arrow); painter.resetTransform(); // Выводим информацию о ребре (flow | capacity) по середине ребра. if (state == ALGORITHM_RUN || (state == ALGORITHM_TERM && edge.flow != 0)) { QPen penForEdgeInfo; penForEdgeInfo.setColor(Qt::darkGreen); painter.setPen(penForEdgeInfo); std::string edgeInfo = "(" + std::to_string(edge.getFlow()) + " | " + std::to_string(edge.getCapacity()) + ")"; painter.drawText(pointFrom.x() + (pointTo.x() - pointFrom.x()) / 2, pointFrom.y() + (pointTo.y() - pointFrom.y()) / 2, edgeInfo.c_str()); } }
void MSArrowButton::redraw(void) { if (mapped()==MSTrue) { drawShadow(); arrow()->draw(); } }
void PremadeMap::drawArrow(void) const { glPushMatrix(); flatTexture arrow(Bomberman::ModelHandler::get().getModel("double_arrow")); glTranslated(680, 562, 0); arrow.draw(); glPopMatrix(); }
static void filter(float x0, float y0, char *letter) { float theta, rad=2.0, x,y,xp,yp, e=0.4; /* vertical half line */ vp_move( x0+.5*dx, y0-.5*dy); vp_draw( x0+.5*dx, y0+(2.5+e)*dy); /* vertical lines */ vp_move( x0- .5*dx, y0-(2.5+e)*dy); vp_draw( x0- .5*dx, y0+(2.5+e)*dy); vp_move( x0-1.5*dx, y0-(2.5+e)*dy); vp_draw( x0-1.5*dx, y0+(2.5+e)*dy); vp_move( x0-2.5*dx, y0-(2.5+e)*dy); vp_draw( x0-2.5*dx, y0+(2.5+e)*dy); /* short horiz lines */ vp_move( x0-(2.5+e)*dx, y0-2.5*dy); vp_draw( x0- .5*dx, y0-2.5*dy); vp_move( x0-(2.5+e)*dx, y0-1.5*dy); vp_draw( x0- .5*dx, y0-1.5*dy); /* longer horiz lines */ vp_move( x0-(2.5+e)*dx, y0- .5*dy); vp_draw( x0+ .5*dx, y0- .5*dy); vp_move( x0-(2.5+e)*dx, y0+ .5*dy); vp_draw( x0+ .5*dx, y0+ .5*dy); vp_move( x0-(2.5+e)*dx, y0+1.5*dy); vp_draw( x0+ .5*dx, y0+1.5*dy); vp_move( x0-(2.5+e)*dx, y0+2.5*dy); vp_draw( x0+ .5*dx, y0+2.5*dy); vp_penup(); /* circles */ for( theta = 90.; theta <=270; theta += 10) { x = x0 + rad * cosf( theta * SF_PI/180.); y = y0 + rad * sinf( theta * SF_PI/180.); vp_pendn( x, y); } /* arrows */ for( theta = 90.+180/10. ; theta <=270; theta += 180./5.) { x = x0 + rad * cosf( theta * SF_PI/180.); y = y0 + rad * sinf( theta * SF_PI/180.); xp = x0 + (rad+.5) * cosf( theta * SF_PI/180.); yp = y0 + (rad+.5) * sinf( theta * SF_PI/180.); arrow( x, y, xp, yp ); } vp_text(x0-.3*dx, y0-.3*dy, 10, 0, letter); }
QChar CharLineEdit::separatorChar() const { QFontMetrics met = fontMetrics(); QChar arrow(0x25ba); if (met.inFont(arrow)) return arrow; else return QChar('|'); }
void MSArrowButton::button1Press(const XEvent *) { arrow()->select(MSTrue); activate(); if (repeatInterval()>0) { if (arrowTimer()==0) _arrowTimer=new MSArrowTimer(repeatThreshold(),this); if (repeatThreshold()==0) arrowTimer()->expirationInterval(repeatInterval()); else arrowTimer()->expirationInterval(repeatThreshold()); arrowTimer()->reset(); } }
void GameState::draw(sf::RenderTarget& target) { sf::View view = target.getView(); if (mInEditor || mToneIn > 0) { float alpha = (mToneIn < 0 ? mInEditor : mToneIn) * 255; sf::RectangleShape tone(view.getSize()); tone.setOrigin(view.getSize()/2.f); tone.setPosition(view.getCenter()); tone.setRotation(view.getRotation()); tone.setFillColor(sf::Color(0,0,0, alpha-55)); target.draw(tone); Kunlaboro::Message msg = sendQuestionToEntity(mPlayer, "GetRadius"); sf::CircleShape platform(boost::any_cast<float>(msg.payload) + 24.f); msg = sendQuestionToEntity(mPlayer, "GetPos"); platform.setOrigin(platform.getRadius(), platform.getRadius()); platform.setFillColor(sf::Color(100,96,96, alpha)); platform.setOutlineColor(sf::Color(210,200,200, alpha)); platform.setOutlineThickness(2.f); platform.setPosition(boost::any_cast<sf::Vector2f>(msg.payload)); target.draw(platform); sf::ConvexShape arrow(7); arrow.setPoint(0, sf::Vector2f(35, 0)); arrow.setPoint(1, sf::Vector2f(15, 15)); arrow.setPoint(2, sf::Vector2f(15, 4)); arrow.setPoint(3, sf::Vector2f(0, 4)); arrow.setPoint(4, sf::Vector2f(0, -4)); arrow.setPoint(5, sf::Vector2f(15, -4)); arrow.setPoint(6, sf::Vector2f(15, -15)); msg = sendQuestionToEntity(mPlayer, "GetRot"); float rot = boost::any_cast<float>(msg.payload); arrow.setRotation(rot); arrow.setPosition(platform.getPosition() + sf::Vector2f(cos(rot * deg2rad), sin(rot * deg2rad)) * (platform.getRadius() + 6)); arrow.setFillColor(sf::Color::Transparent); arrow.setOutlineColor(sf::Color(255,255,255, alpha)); arrow.setOutlineThickness(1.f); target.draw(arrow); } }
void macro1(){ // The values and the errors on the Y axis const int n_points=10; double x_vals[n_points]= {1,2,3,4,5,6,7,8,9,10}; double y_vals[n_points]= {6,12,14,20,22,24,35,45,44,53}; double y_errs[n_points]= {5,5,4.7,4.5,4.2,5.1,2.9,4.1,4.8,5.43}; // Instance of the graph TGraphErrors graph(n_points,x_vals,y_vals,nullptr,y_errs); graph.SetTitle("Measurement XYZ;lenght [cm];Arb.Units"); // Make the plot estetically better graph.SetMarkerStyle(kOpenCircle); graph.SetMarkerColor(kBlue); graph.SetLineColor(kBlue); // The canvas on which we'll draw the graph auto mycanvas = new TCanvas(); // Draw the graph ! graph.DrawClone("APE"); // Define a linear function TF1 f("Linear law","[0]+x*[1]",.5,10.5); // Let's make the funcion line nicer f.SetLineColor(kRed); f.SetLineStyle(2); // Fit it to the graph and draw it graph.Fit(&f); f.DrawClone("Same"); // Build and Draw a legend TLegend leg(.1,.7,.3,.9,"Lab. Lesson 1"); leg.SetFillColor(0); graph.SetFillColor(0); leg.AddEntry(&graph,"Exp. Points"); leg.AddEntry(&f,"Th. Law"); leg.DrawClone("Same"); // Draw an arrow on the canvas TArrow arrow(8,8,6.2,23,0.02,"|>"); arrow.SetLineWidth(2); arrow.DrawClone(); // Add some text to the plot TLatex text(8.2,7.5,"#splitline{Maximum}{Deviation}"); text.DrawClone(); mycanvas->Print("graph_with_law.pdf"); }
void gerrors() { TCanvas *mycanvas = new TCanvas("mycanvs","A Simple Graph with error bars",200,10,700,500); // mycanvas->SetFillColor(42); mycanvas->SetGrid(); // mycanvas->GetFrame()->SetFillColor(21); // mycanvas->GetFrame()->SetBorderSize(12); const int n_points =10; #double x_vals [ n_points]= {1,2,3,4,5,6,7,8,9,10}; double y_vals [ n_points]= {6 ,12 ,14 ,20 ,22 ,24 ,35 ,45 ,44 ,53}; double y_errs [ n_points]= {5 ,5 ,4.7 ,4.5 ,4.2 ,5.1,2.9,4.1,4.8,5.43}; TGraphErrors *gr = new TGraphErrors(n_points,x_vals,y_vals,NULL,y_errs); // TGraphErrors graph(n_points,x_vals,y_vals,NULL,y_errs); gROOT -> SetStyle("Plain"); gr->SetTitle("TGraphErrors Example; lengtht [cm];Arb. Units"); gr->SetMarkerColor(kBlue); gr->SetMarkerStyle(kOpenCircle); gr->SetLineColor ( kBlue ) ; gr->Draw("ALP"); //Define a linear function TF1 f("Linear law" ,"[0]+x*[1]" ,.5 ,10.5) ; // Let's make the funcion line nicer f.SetLineColor(kRed); f.SetLineStyle(2); // Fit it to the graph and draw it gr->Fit(&f); f.DrawClone("Same"); // Build and Draw a legend TLegend leg(.1 ,.7 ,.3 ,.9 ,"Lab. Lesson 1"); leg.SetFillColor (0) ; gr->SetFillColor (0) ; leg.AddEntry(gr,"Exp. Points"); leg.AddEntry(&f,"Th. Law"); leg.DrawClone("Same"); // Draw an arrow on the canvas TArrow arrow(8,8,6.2,23,0.02,"----|>"); arrow.SetLineWidth (2) ; arrow.DrawClone ( ) ; // Add some text to the plot TLatex text(8.2,7.5,"#splitline{Maximum}{Deviation}"); text.DrawClone ( ) ; mycanvas->Update(); mycanvas -> Print("example.pdf"); }
int main() { int recA, recB, arrowA; printf("Please enter the rectangle's width: "); scanf("%i", &recA); printf("Please enter the rectangle's hight: "); scanf("%i", &recB); printf("Please enter the arrow's hight (min is 4): "); scanf("%i", &arrowA); rectangle( recA, recB ); arrow( arrowA ); return 0; }
void display() { cvs.setWindow(-10.0, 10.0, -10.0, 10.0); cvs.setViewPort( 0, 640, 0, 480 ); cvs.clearScreen(); cvs.moveTo(0, 0 ); // draw a line arrow( 3, 1, 4, 1 ); glFlush(); }
void ChangeDisplay::addArrow(Ogre::Vector3 from, Ogre::Vector3 to, int r, int g, int b) { Ogre::SceneNode* frame_node = scene_node_->createChildSceneNode(); ArrowPtr arrow(new Arrow(context_->getSceneManager(), frame_node)); arrow->setColor(255.0, 0, 0, 1.0); arrow->setPosition(from); Ogre::Vector3 direct = to - from; float length = direct.length(); arrow->setDirection(direct); arrow->setScale(Ogre::Vector3(length*0.8, length, length)); frame_node->setPosition(position); frame_node->setOrientation(orientation); arrows.push_back(arrow); }
void PlaneSegmenter::drawNormals() { for(unsigned int d=0; d<directions.size(); ++d) { cv::Scalar c = CV_RGB(255, 0, 0); if(d==1) c = CV_RGB(0, 0, 255); if(d==2) c = CV_RGB(0, 255, 0); for(unsigned int p=0; p<directions.at(d).size(); ++p) { cv::Point2i img_p = world2img(directions.at(d).at(p).pos); cv::Point2f img_n = world2img(directions.at(d).at(p).pos + directions.at(d).at(p).norm*(10)); arrow(rgb_img, img_p.x, img_p.y, 5*(img_p.x-img_n.x)/std::fabs(img_p.x-img_n.x), 5*(img_p.y-img_n.y)/std::fabs(img_p.y-img_n.y), c); } } }
/** * @brief 提示信息显示窗口 * @param [I] 图标 * @param [I] 信息串 * @param [I] 按键 * @param [I] 缺省按键 */ static QMessageBox::StandardButton showMessageBox(QMessageBox::Icon icon, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { WaitCursor arrow(Qt::ArrowCursor); QWidget *parent = qApp->activeModalWidget(); if (!parent) parent = qApp->activeWindow(); if (parent && parent->window()) parent = parent->window(); QMessageBox box(icon, qApp->applicationName(), text, buttons, parent); if (defaultButton != QMessageBox::NoButton) box.setDefaultButton(defaultButton); return (QMessageBox::StandardButton)box.exec(); }
void PlaneSegmenter::drawPlanes() { for(unsigned int p=0; p<planes.size(); ++p) { cv::Scalar c = CV_RGB(255, 0, 0); if(p==1) c = CV_RGB(0, 0, 255); if(p==2) c = CV_RGB(0, 255, 0); if(p==3) c = CV_RGB(255, 255, 0); cv::Point2i img_p = world2img(planes.at(p).pos); cv::Point2f img_n = world2img(planes.at(p).pos + planes.at(p).norm*(10)); std::vector<cv::Point2i> vertices(4); getPlaneBoundaries(&vertices, p); drawRectArea(rgb_img, img_p, vertices, c, 0.5); arrow(rgb_img, img_p.x, img_p.y, 5*(img_p.x-img_n.x)/std::fabs(img_p.x-img_n.x), 5*(img_p.y-img_n.y)/std::fabs(img_p.y-img_n.y), c); } }
/** @brief print a REQ_ACK Prints a snapshot of the status of the @b @@dev circular queue when AP sends or receives an REQ_ACK. @param mld the pointer to a mem_link_device instance @param mst the pointer to a mem_snapshot instance @param dev the pointer to a mem_ipc_device instance (IPC_FMT, etc.) @param dir the direction of communication (TX or RX) */ void print_req_ack(struct mem_link_device *mld, struct mem_snapshot *mst, struct mem_ipc_device *dev, enum direction dir) { #ifdef DEBUG_MODEM_IF_FLOW_CTRL struct link_device *ld = &mld->link_dev; struct modem_ctl *mc = ld->mc; enum dev_format id = dev->id; unsigned int qsize = get_size(cq(dev, dir)); unsigned int in = mst->head[id][dir]; unsigned int out = mst->tail[id][dir]; unsigned int usage = circ_get_usage(qsize, in, out); unsigned int space = circ_get_space(qsize, in, out); mif_info("REQ_ACK: %s%s%s: %s_%s.%d " "{in:%u out:%u usage:%u space:%u}\n", ld->name, arrow(dir), mc->name, dev->name, q_dir(dir), dev->req_ack_cnt[dir], in, out, usage, space); #endif }
void GraphicsArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->setPen(pen()); double mod = 10 / line().length(); QPointF offset = (line().p2()-line().p1())*mod; painter->drawLine(line().p1()+offset, line().p2()-offset); QPen p = pen(); p.setJoinStyle(Qt::MiterJoin); for (auto l : heads) { QGraphicsPolygonItem arrow(l); arrow.setPen(p); arrow.setBrush(pen().color()); arrow.paint(painter, option, widget); } if (isSelected()) { QPen dash(Qt::black, 1, Qt::DashLine); painter->setPen(dash); painter->drawRect(boundingRect()); } }
void drawer::_m_draw_button(graph_reference graph, rectangle r, buttons what, int state) { if(_m_check()) _m_button_frame(graph, r, state); if(buttons::first == what || buttons::second == what) { auto sz = graph.size(); int top = static_cast<int>(sz.height - fixedsize); int left = static_cast<int>(sz.width - fixedsize); direction dir; if (buttons::second == what) { if (vertical_) { r.y = top; dir = direction::south; } else { r.x = left; dir = direction::east; } } else dir = vertical_ ? direction::north : direction::west; if (vertical_) r.x = left / 2; else r.y = top / 2; r.width = r.height = 16; facade<element::arrow> arrow(states::none == state ? "hollow_triangle" : "solid_triangle"); arrow.direction(dir); arrow.draw(graph, {}, (_m_check() ? colors::black : colors::gray), r, element_state::normal); } }