本文整理汇总了C++中drawTree函数的典型用法代码示例。如果您正苦于以下问题:C++ drawTree函数的具体用法?C++ drawTree怎么用?C++ drawTree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawTree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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();
}
示例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);
}
}
示例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);*/
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
}
}
示例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);
}
示例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();
}
示例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);
}
}
示例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;
}