当前位置: 首页>>代码示例>>C++>>正文


C++ rotateLeft函数代码示例

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


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

示例1: balanceLeft

Tree balanceLeft(Tree t) {

  if(t -> left -> bf == LH) {
    // simple (rotate right)
    t = rotateRight(t);
    t -> bf = EH;
    t -> right -> bf = EH;
  }
  else {
    // double (rotate left and then right)
    t -> left = rotateLeft(t -> left);
    t = rotateRight(t);
    switch(t->bf) {
      case EH:
        t -> left -> bf = EH;
        t -> right -> bf = EH;
        break;
      case RH:
        t -> left -> bf = LH;
        t -> right -> bf = EH;
        break;
      case LH:
        t -> left -> bf = EH;
        t -> right -> bf = RH;
    }
    t -> bf = EH;
  }

  return t;
}
开发者ID:ruimiguelsantos,项目名称:cstructspoc,代码行数:30,代码来源:avlBKP.c

示例2: rotateLeft

void Align::rotatePolar(double angle){

    rotateLeft(3*M_PI/2);    
    double seconds =  ((angle) * ROBOT_DIAMETER * M_PI) / (2 * M_PI * 3.0 * WHEEL_RAD);
	
	seconds = seconds - (9.15*(seconds / 100));

	//stop
	if(seconds < 0.0){
		diffDrive.call(msg_turn_right);
		seconds = seconds * -1;
	}else{
	diffDrive.call(msg_turn_left);
	}



        //sleep until at correct angle
        ros::Duration(seconds).sleep();

        //stop rotating
        diffDrive.call(msg_stop);
        //ros::Duration(3).sleep();
        ready = 1;
	//ROS_INFO("Rotate Position: %d", position);
}
开发者ID:shinroo,项目名称:TUB_Programs,代码行数:26,代码来源:align.cpp

示例3: tr

void MyGallery::setupActions()
{
  p->toolbar->addAction(QIcon::fromTheme("object-rotate-left"),
                  tr("Rotate Left"), p->viewer->obj(), SLOT(rotateLeft()));
  p->toolbar->addAction(QIcon::fromTheme("object-rotate-right"),
                  tr("Rotete Right"), p->viewer->obj(), SLOT(rotateRight()));
}
开发者ID:qidaizhe11,项目名称:QingfengGallery-backup,代码行数:7,代码来源:MyGallery.cpp

示例4: rotateLeft

void AVLTree<K, V>::rotateLeftRight(Node * & t)
{
        *_out << __func__ << endl; // Outputs the rotation name (don't remove this)
        // Implemented for you:
        rotateLeft(t->left);
        rotateRight(t);
}
开发者ID:chrislee0793,项目名称:CS225,代码行数:7,代码来源:avltree.cpp

示例5: Node

void AVLTree<K, V>::insert(Node* & subtree, const K & key, const V & value)
{
        if(subtree == NULL) {
                subtree = new Node(key, value);
                return;
        }      
        if(subtree->key == key) return;
 
        if(key < subtree->key) {
                insert(subtree->left, key, value);
        } else {
                insert(subtree->right, key, value);
        }
        if(heightOrNeg1(subtree->right) - heightOrNeg1(subtree->left) == 2) {
                if(subtree->right != NULL) {
                        if(heightOrNeg1(subtree->right->left) > heightOrNeg1(subtree->right->right)) {
                                rotateRightLeft(subtree);
                        } else if (heightOrNeg1(subtree->right->left) < heightOrNeg1(subtree->right->right)) {
                                rotateLeft(subtree);
                        }
                }
        } else if(heightOrNeg1(subtree->right) - heightOrNeg1(subtree->left) == -2) {
                if(subtree->left != NULL) {
                        if(heightOrNeg1(subtree->left->right) > heightOrNeg1(subtree->left->left)) {
                                rotateLeftRight(subtree);
                        } else if(heightOrNeg1(subtree->left->right) < heightOrNeg1(subtree->left->left)) {
                                rotateRight(subtree);
                        }
                }      
        }
        subtree->height = calculateSubtreeHeight(subtree);
}
开发者ID:chrislee0793,项目名称:CS225,代码行数:32,代码来源:avltree.cpp

示例6: rotateRight

void AVLTree<K, V>::rotateRightLeft(Node * & t)
{
	*_out << __func__ << endl; // Outputs the rotation name (don't remove this)
    // your code here
	rotateRight(t->right);
	rotateLeft(t);
}
开发者ID:killbug2004,项目名称:Snippets,代码行数:7,代码来源:avltree.cpp

示例7: balanceLeft

/*Balanceamento da AVL a esquerda*/
AVL balanceLeft(AVL p) {
	if(p->left->bf==LH) {
		p=rotateRight(p);
		p->bf=EH;
		p->right->bf=EH;
	}
	else {
		p->left=rotateLeft(p->left);
		p=rotateRight(p);
		switch(p->bf) {
		case EH:
			p->left->bf=EH;
			p->right->bf=EH;
			break;
		case RH:
			p->right->bf=EH;
			p->left->bf=LH;
			break;
		case LH:
			p->right->bf=RH;
			p->left->bf=EH;
		}
		p->bf=EH;
	}
	return p;
}
开发者ID:zecarlos94,项目名称:LI3_GZT,代码行数:27,代码来源:avl.c

示例8: FloatFrame

void MainWindow::initButtomBar()
{
    bottomFrame = new FloatFrame(this);
    ///set all the button's focous policy to Qt::NoFocous in 'ui' file.

    contralBar = new ContralBar(bottomFrame);
    bottomFrame->addWidget(contralBar);

    QHBoxLayout *hlayout = new QHBoxLayout(bottomFrame);
    hlayout->setContentsMargins(0,0,0,0);   ///qframe's layout margis default is not 0.
    hlayout->setAlignment(Qt::AlignCenter);
    hlayout->addWidget(contralBar);
    bottomFrame->setLayout(hlayout);

    settingButton = contralBar->settingButton;
    openButton = contralBar->openButton;
    preButton = contralBar->preButton;
    playButton = contralBar->playButton;
    nextButton = contralBar->nextButton;
    rotateLeftButton = contralBar->rotateLeftButton;
    rotateRightButton = contralBar->rotateRightButton;
    deleteButton = contralBar->deleteButton;

    connect(settingButton, SIGNAL(clicked()), SLOT(setting()));
    connect(openButton, SIGNAL(clicked()), SLOT(openFile()));
    connect(preButton, SIGNAL(clicked()), viewer, SLOT(prePic()));
    connect(playButton, SIGNAL(clicked()), SLOT(switchSlideShow()));
    connect(nextButton, SIGNAL(clicked()), viewer, SLOT(nextPic()));
    connect(rotateLeftButton, SIGNAL(clicked()), viewer, SLOT(rotateLeft()));
    connect(rotateRightButton, SIGNAL(clicked()), viewer, SLOT(rotateRight()));
    connect(deleteButton, SIGNAL(clicked()), viewer, SLOT(deleteFileAsk()));

    bottomFrame->installEventFilter(this);
}
开发者ID:404neko,项目名称:ezviewer-1,代码行数:34,代码来源:mainwindow.cpp

示例9: QWidget

FlightPanel::FlightPanel(QWidget *parent):
    QWidget(parent),
    wi(this),
    timer(this)
{
    up.reset(new QPushButton(QIcon(), QString("up"), this));
    down.reset(new QPushButton(QIcon(), QString("down"), this));
    left.reset(new QPushButton(QIcon(), QString("left"), this));
    right.reset(new QPushButton(QIcon(), QString("right"), this));

    up->resize(   controlHeight, controlHeight/2.5);
    down->resize( controlHeight, controlHeight/2.5);
    left->resize( controlHeight, controlHeight/2.5);
    right->resize(controlHeight, controlHeight/2.5);

    QRect rect = QRect(0, 0, this->width(), this->height() - 50);
    wi.setGeometry(rect);
    wi.setVisible(true);

    QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(tick()));

    QObject::connect(up.get(), SIGNAL(clicked()),    &wi, SLOT(rotateUp()));
    QObject::connect(down.get(), SIGNAL(clicked()),  &wi, SLOT(rotateDown()));
    QObject::connect(left.get(), SIGNAL(clicked()),  &wi, SLOT(rotateLeft()));
    QObject::connect(right.get(), SIGNAL(clicked()), &wi, SLOT(rotateRight()));
    timer.setInterval(200);
    timer.start();
}
开发者ID:Andrey-Dubas,项目名称:diploma,代码行数:28,代码来源:flightpanel.cpp

示例10: rotate

void rotate()
{	
	if(speed > 10)
		rotateLeft(MAXSPEED/(speed-10));
	else if(speed < 10)
		rotateRight(MAXSPEED/(10-speed));
}
开发者ID:russellaabuchanan,项目名称:microp_embedded,代码行数:7,代码来源:Thread_LED.c

示例11: switch

int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: openFile(); break;
        case 1: applyChanges(); break;
        case 2: saveFile(); break;
        case 3: exit(); break;
        case 4: effects(); break;
        case 5: zoom(); break;
        case 6: resize(); break;
        case 7: crop(); break;
        case 8: rotateRight(); break;
        case 9: rotateLeft(); break;
        case 10: mirror(); break;
        case 11: reflection(); break;
        case 12: grayScale(); break;
        case 13: xray(); break;
        case 14: sepia(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
开发者ID:julioce,项目名称:CompGraf,代码行数:28,代码来源:moc_mainwindow.cpp

示例12: print_permutation

void print_permutation(char *wordRa){
	static count;
	char singleWord[2];
	char aheadWord[10],currentwordRa[10];
	int index,wordRalength,i;
	wordRalength=strlen(wordRa);
	if(wordRalength>2){
		
		strcpy(currentwordRa,wordRa);
		for(i=0;i<wordRalength;i++){
			singleWord[0]=currentwordRa[0];
			singleWord[1]='\0';
			strcat(toBePrinted,singleWord);
			strcpy(aheadWord,currentwordRa+1);
			print_permutation(aheadWord);
			index=strlen(toBePrinted)-1;
			toBePrinted[index]='\0';
			rotateLeft(currentwordRa);
		}
		
	}else
	{
		//printf("\n%d)TOBEpTelse=%s",++count,toBePrinted);
		printf("\n%s",toBePrinted);
		printf("%s",wordRa);
		//printf("\n%d)TOBEpTelse=%s",++count,toBePrinted);
		printf("\n%s",toBePrinted);
		printf("%c%c",wordRa[1],wordRa[0]);
	}
}
开发者ID:nebukanezar,项目名称:stringpermutation,代码行数:30,代码来源:2.c

示例13: while

/*
void MovieTree::fixUpAdd(Movie*)

Description:
Private method used to balance the tree after adding a movie.

Example:
MovieTree tree;
tree.addMoviebyTitle("Back to the Future", 1985, 96, 5);

Precondition:
The ends of the tree are nil. The tree is arranged correctly.

Postcondition:
The tree will be balanced.
*/
void MovieTree::fixUpAdd(Movie *x)
{
    x->isRed = true;

    while (x != root && x->parent->isRed) {
        if (x->parent == x->parent->parent->left) {
            Movie *y = x->parent->parent->right;

            if (y->isRed) {
                x->parent->isRed = false;
                y->isRed = false;
                x->parent->parent->isRed = true;
                x = x->parent->parent;
            } else {
                if (x == x->parent->right) {
                    x = x->parent;
                    rotateLeft(x);
                }

                x->parent->isRed = false;
                x->parent->parent->isRed = true;
                rotateRight(x->parent->parent);
            }
        } else {
            Movie *y = x->parent->parent->left;

            if (y->isRed) {
                x->parent->isRed = false;
                y->isRed = false;
                x->parent->parent->isRed = true;
                x = x->parent->parent;
            } else {
                if (x == x->parent->left) {
                    x = x->parent;
                    rotateRight(x);
                }

                x->parent->isRed = false;
                x->parent->parent->isRed = true;
                rotateLeft(x->parent->parent);
            }
        }
    }

    root->isRed = false;
}
开发者ID:AdamEParnes,项目名称:Anderson_CSCI2270_FinalProject,代码行数:62,代码来源:MovieTree.cpp

示例14: fprintf

int AVLTree::ins(AVLNode* &p, FFSObject *e) {
    int deltaH = 0;
    if (p == NULL) {
	p = new AVLNode;
#ifdef _DEBUG_AVL
	AVLTree::tree_cnt++;
#endif
	p->elem = e;
	p->bal = 0;
	p->left = p->right = NULL;
	deltaH = 1;  /* tree hight increased by 1 */
#ifdef _DEBUG_AVL
	fprintf(stderr, "added %s to AVLTree (count %d)\n", 
		e->getName(), count);
#endif
    } else if (compareType == AVL_CMP_NAME
	       ? e->compareName(p->elem) > 0
	       : e->compareAll(p->elem) > 0) {
	if (ins(p->right, e)) {
	    p->bal++; /* height of right subtree increased */
	    if (p->bal == 1) {
		deltaH = 1;
	    } else if (p->bal == 2) {
		if (p->right->bal == -1) {
		    rotateRight(p->right);
		}
		rotateLeft(p);
	    }
	}
    } else /* if (e->compareAll(p->elem) <= 0)*/ {
	if (ins(p->left, e)) {
	    p->bal--;
	    if (p->bal == -1) {
		deltaH = 1;
	    } else if (p->bal == -2) {
		if (p->left->bal == 1) {
		    rotateLeft(p->left);
		}
		rotateRight(p);
	    }
	}
    }
    return deltaH;
}
开发者ID:alaeri,项目名称:3dfm,代码行数:44,代码来源:AVLTree.cpp

示例15: insertSplay

/*
	Notes:
	* tree insertion using splay method
	* produces different results to the visualiser

*/
Link insertSplay(Link n, int value)
{
	if (n == NULL) { return newNode(value); }

	if (value < n->value){ // right rotations
		if (n->left == NULL){ // left branch is NULL
			n->left = newNode(value);
		}

		else if (value < n->left->value){ // zig zig left
			n->left->left = insertSplay(n->left->left, value);
			// n->left = rotateRight(n->left);
			n = rotateRight(n);
		}

		else{ // zig zag left
			n->left->right = insertSplay(n->left->right, value);
			n->left = rotateLeft(n->left);
		}

		n = rotateRight(n);
	}

	if (value > n->value){ // left rotations
		if (n->right == NULL){
			n->right = newNode(value);
		}

		else if (value > n->right->value){ // zig zig right
			n->right->right = insertSplay(n->right->right, value);
			// n->right = rotateLeft(n->right);
			n = rotateLeft(n);
		}

		else{ // zig zag right
			n->right->left = insertSplay(n->right->left, value);
			n->right = rotateRight(n->right);
		}
		
		n = rotateLeft(n);
	}

	return n;
}
开发者ID:matthewT53,项目名称:Data-structures-and-algorithms,代码行数:50,代码来源:splay.c


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