• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ drawTree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中drawTree函数的典型用法代码示例。如果您正苦于以下问题:C++ drawTree函数的具体用法?C++ drawTree怎么用?C++ drawTree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了drawTree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: drawTree

void drawTree(uint16_t x, uint16_t y, binTree_t* pTree)
{
    char buf[10];
    uint16_t width;
    uint16_t lWidth;
    uint16_t rWidth;
    uint16_t rx;
    uint16_t ry;
    if (pTree == NULL) {
        return;
    }
    memset(buf, 0, sizeof(buf));
    itoa(pTree->value, buf, 10);

    terminal_draw_char(x, y, buf);

    rWidth = getWidth(pTree->right, RIGHT);
    lWidth = getWidth(pTree->left, LEFT);
    width = rWidth > lWidth ? rWidth : lWidth;
    if (pTree->left) {
        drawBranch(x - 1, y + 1, &rx, &ry, width, LEFT);
        drawTree(rx, ry, pTree->left);
//        termial_draw_char(x - 1, y + 1, "/");
//        drawTree(x - 2, y + 2, pTree->left);
    }

    if (pTree->right) {
        drawBranch(x + 1, y + 1, &rx, &ry, width, RIGHT);
        drawTree(rx, ry, pTree->right);
//        termial_draw_char(x + 1, y + 1, "\\");
//        drawTree(x + 2, y + 2, pTree->right);
    }

}
开发者ID:llyanGithub,项目名称:c-exercise,代码行数:34,代码来源:tree.c


示例2: plotLeading

void plotLeading(char * infname1 = "/net/pstore01/d00/scratch/frankma/hiroot/pythia100_5k_truth_000777.root",
                 char * infname2 = "/net/pstore01/d00/scratch/frankma/hiroot/pyquen100_5k_truth_000777.root")
{
   printf("%s\n",infname1);
   printf("%s\n",infname2);
   TFile * infile = new TFile(infname1);
   TNtuple * ntpythia = dynamic_cast<TNtuple*>(infile->Get("NTLPartons"));
   TFile * infile2 = new TFile(infname2);
   TNtuple * ntpyquen = dynamic_cast<TNtuple*>(infile2->Get("NTLPartons"));
   TFile * outfile = new TFile("LeadingHistos.root","RECREATE");

   //--- inv mass ---
   drawTree(ntpythia, "mass>>hMassPythia","nlpet>1 && alpet>1",drsg,    "hMassPythia","Pythia: inv mass of dijet",100,0,1800,true,kRed,1,3);
   drawTree(ntpyquen, "mass>>hMassPyquen","nlpet>1 && alpet>1",drdb,"hMassPyquen","draw Pyquen: inv mass of dijet",100,0,1800,true,kBlue,1,3);
   
   //--- Et ---
   // -near-
   drawTree(ntpythia, "nlpet>>hNearLPartonPythia","nlpet>1",drsg,    "hNearLPartonPythia","Pythia: leading partons",100,80,200,true,kRed,1,3);
   drawTree(ntpyquen, "nlpet>>hNearLPartonPyquen","nlpet>1",drdb,"hNearLPartonPyquen","Pyquen: leading partons",100,80,200,true,kBlue,1,3);
   // -away--
   drawTree(ntpythia, "alpet>>hAwayLPartonPythia","alpet>1",drdb,"hAwayLPartonPythia","Pythia: leading partons",100,80,200,true,kRed,7,3);
   drawTree(ntpyquen, "alpet>>hAwayLPartonPyquen","alpet>1",drdb,"hAwayLPartonPyquen","draw Pyquen: leading partons",100,80,200,true,kBlue,7,3);

   //--- dphi ---
   drawTree(ntpythia, "dphi>>hdPhiPythia","nlpet>1 && alpet>1",drsg,"hdPhiPythia","Pythia: dphi of leading partons",100,0,3.14,true,kRed,1,3);
   drawTree(ntpyquen, "dphi>>hdPhiPyquen","nlpet>1 && alpet>1",drdb,"hdPhiPyquen","draw Pyquen: dphi of leading partons",100,0,3.14,true,kBlue,1,3);

   //--- Et ratio ---
   drawTree(ntpythia, "(alpet/nlpet)>>hEtRatioPythia","",drsg,"hEtRatioPythia","Pythia: Et ratio of leading partons",100,0,1.5,true,kRed,1,3);
   drawTree(ntpyquen, "(alpet/nlpet)>>hEtRatioPyquen","",drdb,"hEtRatioPyquen","draw Pyquen: Et ratio of leading partons",100,0,1.5,true,kBlue,1,3);

   printAllCanvases();
   outfile->Write();
   outfile->Close();
}
开发者ID:CmsHI,项目名称:CVS_SavedFMa,代码行数:35,代码来源:plotLeading.C


示例3: drawTree

  void DBVH::drawTree( DBVHNode* node, unsigned depth )
  {
    if(node)
    {
//       if(debug && ((depth == maxDrawDepth) || (depth < maxDrawDepth && node->leaf)))
//           dbgDraw->drawAABB(node->boundingBox, vec4(1.0f, 0.0f, 0.0f, 1.0f));

      if(node->leaf)
      {
        for(unsigned i = 0; i < node->objects.size(); ++i)
        {
          for(unsigned j = 0; j < node->objects[i].meshes.size(); ++j)
          {
            D3D10_TECHNIQUE_DESC techDesc;
            tech->GetDesc( &techDesc );
            for(UINT p = 0; p < techDesc.Passes; ++p)
            {
              node->objects[i].meshes[j]->setMtw();
              tech->GetPassByIndex( p )->Apply(0);  
              node->objects[i].meshes[j]->draw();
            }
          }
        }
      }

      drawTree(node->left, depth + 1);
      drawTree(node->right, depth + 1);
    }
  }
开发者ID:Branden-Turner,项目名称:DirectXApps,代码行数:29,代码来源:dbvh.cpp


示例4: drawTree

void drawTree(SDL_Simplewin *sw, node *tree,
                        fntrow fnt[FNTCHARS][FNTHEIGHT])
{
    cart parent, this;

    if(tree==NULL){
        return;
    }
    drawTree(sw, tree->c0, fnt);
    drawTree(sw, tree->c1, fnt);

    if(tree->y > 0){
        this = getTreeCoord(tree);
        parent = getTreeCoord(tree->parent);


        SDL_SetRenderDrawColor(sw->renderer, COL_TREE_GREEN, OPAQUE);
        SDL_RenderDrawLine(sw->renderer, parent.x, parent.y,
                                this.x, this.y);

        if(tree->chr){
            Neill_SDL_DrawChar(sw, fnt, tree->chr,
                                 this.x-(FNTWIDTH/2), this.y);
        } else {
            setRandColour(sw);
            Neill_SDL_RenderFillCircle(sw->renderer, this.x, this.y, CIRCRAD);
            SDL_SetRenderDrawColor(sw->renderer, COL_WHITE, OPAQUE);
            /*drawCirc(sw, this, CIRCRAD);*/
        }

    }
}
开发者ID:DanBennettDev,项目名称:huffman,代码行数:32,代码来源:huffsdl.c


示例5: drawTree

void drawTree(float initX, float initY, float degree, int length)
{
    //base case
    if(length < minLength)
    {
        return;
    }
    else
    {
        //decrease the length of the segment to be 2.0/3 that of the previous segment
        float newLength = decreaseFactor * length;
        
        //calculates new final x and y values
        float finalX = initX + newLength * cos(degree * M_PI / convertToRadian);
        float finalY = initY + newLength * sin(degree * M_PI / convertToRadian);
        
        //creates a line from initial point to final point
        sf::Vertex line[] =
        {
            sf::Vertex(sf::Vector2f(initX, initY)),
            sf::Vertex(sf::Vector2f(finalX, finalY))
        };
        
        window.draw(line, 2, sf::Lines);
        
        //double tail recursion to draw both sides of the branches of the tree
        drawTree(finalX, finalY, degree - angle, newLength);
        
        drawTree(finalX, finalY, degree + angle, newLength);
        

    }
    
}
开发者ID:cindyhom,项目名称:fractal-tree,代码行数:34,代码来源:FractalTree.cpp


示例6: drawTree

int drawTree(nodeStructure* rootNode) {
    if (rootNode->l == NULL && rootNode->r == NULL) {
        printf("(%c - %d)", rootNode->c, rootNode->freq);
        return 0;
    }
    printf("%p\n", rootNode);
    drawTree(rootNode->l);
    drawTree(rootNode->r);
    return 0;
}
开发者ID:dfx29,项目名称:compress,代码行数:10,代码来源:main.c


示例7: drawTree

void drawTree (const Camera& cam, Framebuffer& buf, const Aabb& box, const Node* node) {
    if (node == nullptr) {
        buf.unsafeDrawAabb (cam, box, Colour {0.333, 0.333, 0.333});
        return;
    }

    Aabb left, right;
    box.split_at (left, right, node->m_axis, node->m_split);
    drawTree (cam, buf, left, node->m_left);
    drawTree (cam, buf, right, node->m_right);
}
开发者ID:srishti26,项目名称:ray,代码行数:11,代码来源:kdtree_primitive_manager.cpp


示例8: drawTree

void drawTree(Image* img, treeNode* node) {
  img->setPixelAA(node->point.X, node->point.Y, Pixel(255,255,255,255));
  if (node->left) {
    FilterSimple_Line_AA(img, node->point.X, node->point.Y, node->left->point.X, node->left->point.Y, Pixel(255, 0, 0, 255));
    drawTree(img, node->left);
  }
  if (node->right) {
    FilterSimple_Line_AA(img, node->point.X, node->point.Y, node->right->point.X, node->right->point.Y, Pixel(0, 255, 0, 255));
    drawTree(img, node->right);
  }
  return;
}
开发者ID:kg,项目名称:Fury2,代码行数:12,代码来源:Pathfind.cpp


示例9: drawTree

  void KDTree::drawTree( KDNode* tree, unsigned depth )
  {
    if(depth == maxDrawDepth)
      return;

    if(tree)
    {
      dbgDraw->drawAABB(tree->boundingBox);
      drawTree(tree->childLeft, depth + 1);
      drawTree(tree->childRight, depth + 1);
    }
  }
开发者ID:Branden-Turner,项目名称:DirectXApps,代码行数:12,代码来源:kdtree.cpp


示例10: Draw

void MainWindow::drawTree(Node * root)
{
    Draw(root);
    if(root->getLeft()!=0 && root->getRight()!=0)
    {
        drawTree(root->getLeft());
        drawTree(root->getRight());
    }
    else if(root->getLeft()!=0)
    {
        drawTree(root->getLeft());
    }
}
开发者ID:negarrahmati,项目名称:C-project---Circuit-Designer,代码行数:13,代码来源:mainwindow.cpp


示例11: glColor3f

void octreeSolid::drawTree(octreeSNode *node, int mode)
{

	if (node->bEnd)
	{
		glColor3f(1,0,0);
		Util_w::drawBoxWireFrame(node->leftDownf, node->rightUpf);
	}
	else
	{
		glColor3f(0,1,0);
		if (mode == 0)
		{
			Util_w::drawBoxWireFrame(node->leftDownf, node->rightUpf);
		}

		for (int i = 0; i < 8; i++)
		{
			if (node->children[i])
			{
				drawTree(node->children[i], mode);
			}
		}
	}
}
开发者ID:pigoblock,项目名称:TFYP,代码行数:25,代码来源:octreeSolid.cpp


示例12: drawTree

void drawTree(node* treeRoot, int level) {
  int hasBranches = 0;

  drawPoints(treeRoot->nodeBounds, level);
  for(int i = 0; i < 4; i++) {
    if(treeRoot->branches[i]) {
      drawTree(treeRoot->branches[i], level+1);
      hasBranches = 1;
    }
  }

  glPointSize(2.0f);

  if(hasBranches == 0)
    glColor3b(127, 0, 0);
  else
    glColor3b(0, 64, 0);

  if(treeRoot->nodeBody) {
    glBegin(GL_POINTS);
      glVertex2d(treeRoot->nodeBody->xP, treeRoot->nodeBody->yP);
    glEnd();
  }

  glColor3b(127, 127, 127);
}
开发者ID:btheobald,项目名称:bhnsim,代码行数:26,代码来源:render.c


示例13: glPushMatrix

void Tree::draw()
{
	glPushMatrix();
		glTranslatef(position.x, position.y, position.z);
		drawTree(size);
		for (int i = 0; i < bcount; i++)
		{
			glPushMatrix();
				glTranslatef(0,branches[i].x,0);
				glRotatef(branches[i].y, 0, 1, 0);
				glRotatef(90, 0, 0, 1);
				drawTree(branches[i].z);
			glPopMatrix();
		}		
	glPopMatrix();
}
开发者ID:kypp,项目名称:running-game,代码行数:16,代码来源:objects.cpp


示例14: drawTree

void octreeSolid::draw(BOOL mode[10])
{
	if (mode[1]){
		for (int i = 0; i < leaves.size(); i++){
			leaves[i]->drawWireBox();
		}
	}

	if (mode[2]){
		if (sufObj){
			sufObj->drawObject();	
		}
	}

	if (mode[3]){
		if (m_root){
			drawTree(m_root);
		}
	}

	if (mode[4]){
		if (sufObj){
			sufObj->drawBVH();
		}
	}

	if (mode[5]){
		drawTightTree(m_root);
	}
}
开发者ID:pigoblock,项目名称:TFYP,代码行数:30,代码来源:octreeSolid.cpp


示例15: main

int main(int argc, char ** argv)

{
    //while the window is open
    while(window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed) {
                window.close();
            }
            
            // Escape pressed: exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
        }
        
        window.clear();
        drawTree(initX, initY, degree, length);
        window.display();
        
    }

    return 0;
 
}
开发者ID:cindyhom,项目名称:fractal-tree,代码行数:29,代码来源:FractalTree.cpp


示例16: display

void display(void)
{
  glClear (GL_COLOR_BUFFER_BIT);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  //glColor3f (1.0, 1.0, 1.0);  
  glLoadIdentity ();             /* clear the matrix */
  gluLookAt (eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
  /* viewing transformation  */ 
  
  
  //glTranslatef(0,0,0);

  //rotate? 
  //printf("%f, %f, %f\n",translate_x,translate_y,translate_z);
  glTranslatef(translate_x,translate_y,translate_z);
  glScalef (scale_x, scale_y, scale_z);      /* modeling transformation */ 
  
  glRotatef(rotate_angle_y, 0.0f, 1.0f, 0.0f);
  glRotatef(rotate_angle_x, 1.0f, 0.0f, 0.0f);
  glRotatef(rotate_angle_z, 0.0f, 0.0f, 1.0f);

  //glutWireSphere(1.0f, 25, 25);
  //houseAngle += 0.05f;
  
  if (!figure)
    drawHouse();
  else
    drawTree();
       
  glFlush ();
  glutSwapBuffers();
}
开发者ID:kmels,项目名称:opengl-basics,代码行数:33,代码来源:main.c


示例17: doDisplay

void doDisplay(node *tree)
{
    SDL_Simplewin sw;
    fntrow font[FNTCHARS][FNTHEIGHT];
    unsigned drawcounter=0;


    /*set up screen*/
    SDL_myInit(&sw);
    Neill_SDL_ReadFont(font, FONTFILE);

    do { /* draw and animate tree */
        SDL_Delay(SDL_LOOP_DELAY);
        drawcounter += SDL_LOOP_DELAY;

        Neill_SDL_Events(&sw);

        if(drawcounter>= LIGHT_CHANGE_DELAY){
            drawcounter=0;
            drawTree(&sw, tree, font);
            Neill_SDL_DrawString(&sw, font, "Xmas (Binary) Tree",
                                        0, TITLE_POS);

            /* update window once */
            SDL_RenderPresent(sw.renderer);
            SDL_UpdateWindowSurface(sw.win);
        }
    }
    while (!sw.finished);

}
开发者ID:DanBennettDev,项目名称:huffman,代码行数:31,代码来源:huffsdl.c


示例18: vv

VoxelImage *makeTree()
{
  int vw=256;

  FastVoxelView vv(vw,vw,Pos3D(256,512,0),false,1);
  drawPlane(vv,vw);
  drawTree(vv,Pos3D(128,0,128),140);
  return new VoxelImage(vv.getSurface(),Pos3D(0,0,0));
}
开发者ID:BackupTheBerlios,项目名称:antargis-svn,代码行数:9,代码来源:tree.cpp


示例19: main

int main() {
	initGraphics();

	/* Draw a tree rooted at the bottom-center, whose height is the height of the
	 * window and is initially pointing up.
	 */
	drawTree(getWindowWidth() / 2.0, getWindowHeight(), getWindowHeight(), 90.0, 0);

	return 0;
}
开发者ID:JavierPalomares90,项目名称:CS106B,代码行数:10,代码来源:Tree.cpp


示例20: drawTree

static void drawTree(const TransformState& transState, const OctreeNode* node)
{
    Imath::Box3f bbox(node->center - Imath::V3f(node->radius),
                        node->center + Imath::V3f(node->radius));
    drawBoundingBox(transState, bbox, Imath::C3f(1));
    drawBoundingBox(transState, node->bbox, Imath::C3f(1,0,0));
    for (int i = 0; i < 8; ++i)
    {
        OctreeNode* n = node->children[i];
        if (n)
            drawTree(transState, n);
    }
}
开发者ID:gphysics,项目名称:displaz,代码行数:13,代码来源:pointarray.cpp



注:本文中的drawTree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ drawTriangle函数代码示例发布时间:2022-05-30
下一篇:
C++ drawString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap