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


C++ Matrix::setTrans方法代码示例

本文整理汇总了C++中osg::Matrix::setTrans方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::setTrans方法的具体用法?C++ Matrix::setTrans怎么用?C++ Matrix::setTrans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Matrix的用法示例。


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

示例1: vehiclePoseCallback

void vehiclePoseCallback(const nav_msgs::Odometry& odom) {
	if (!firstpass) {
		initialT.set(odom.pose.pose.position.x,odom.pose.pose.position.y,odom.pose.pose.position.z);
		initialQ.set(odom.pose.pose.orientation.x, odom.pose.pose.orientation.y, odom.pose.pose.orientation.z, odom.pose.pose.orientation.w);
		wMv_initial.setTrans(initialT);
		wMv_initial.setRotate(initialQ);
		firstpass=true;
	} 
}
开发者ID:perezsolerj,项目名称:underwater_simulation,代码行数:9,代码来源:setVehicleDisturbances.cpp

示例2: zoomOut

void CameraFlight::zoomOut(osg::Vec3 v, osg::Matrix mat)
{
    if(t < 5) {
	v[1] = (-a*pow((t-5),2)) + maxHeight;

    }

    else {
	a = (maxHeight - minHeight)/25.0;
	v[1] = (-a*pow((t-5),2)) + maxHeight;
    }

    mat.setTrans(v);
    SceneManager::instance()->setObjectMatrix(mat);

}
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:16,代码来源:CameraFlight.cpp

示例3: buttonEvent

bool CameraFlight::buttonEvent(int type/*, const osg::Matrix & mat*/)
{
//    osg::Matrix curMatrix = SceneManager::instance()->getObjectTransform()->getMatrix();
//    double curScale = SceneManager::instance()->getObjectScale();

 //   osg::Matrix w2o = SceneManager::instance()->getWorldToObjectTransform();
 //   osg::Matrix o2w = SceneManager::instance()->getObjectToWorldTransform();

    if(type == 'p') {
	std::cerr<<"curMatrix"<<endl;
	printMat(curMatrix, curScale);
	
	cout<<"x = "<<latLonHeight.x()<<", y = "<<latLonHeight.y()<<", z = "<<latLonHeight.z()<<endl;
//	std::cerr<<"WorldToObject"<<endl;
//	printMat(w2o, curScale);

//	std::cerr<<"ObjectToWorld"<<endl;
//	printMat(o2w, curScale);
    }

    else if(type == 'd') {
	curMatrix.decompose(trans1, rot1, scale1, so1);

	std::cerr<<"<<<<<<<<<<<<<<<<<<<<<<<<<<<<"<<endl;
	cout<<"Trans = ";
	printVec(trans1);

	cout<<"Scale = ";
	printVec(scale1);

	cout<<"Rotate = ";
	printQuat(rot1);

	cout<<"Scale Orient =";
	printQuat(so1);

	std::cerr<<"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"<<endl;
	    //osg::Matrix _trans = osg::Matrix::rotate(oldPos,currentPos) * osg::Matrix::translate(trans);
	
	    
	    //osg::Matrix rotMat = osg::Matrix::rotate(oldPos,currentPos);
	    //osg::Matrix wr = o2w * rotMat* w2o; 
//	    osg::Matrix _tmp = w2o * osg::Matrix::rotate(oldPos,currentPos) * o2w;
	    //osg::Matrix _scale = osg::Matrix::scale(scale);
	    //osg::Matrix _temp = osg::Matrix::translate(-trans) * _scale * _trans;

    }

    else if(type == 't') {
	curMatrix.setTrans(osg::Vec3(0.0,1e+09/*6.41844e+09*/,0));
	SceneManager::instance()->setObjectMatrix(curMatrix);
    }

    else if(type == 's') {
	_origMatrix = SceneManager::instance()->getObjectTransform()->getMatrix();
	_origScale = SceneManager::instance()->getObjectScale();
    }

    else if(type == 'z') {
	tstart = time(0);
//	zIn = 1e+10; 
//	zOut = 1e+10;
	cout<<"zpressed"<<endl;
	if (flagZoom == false)
	    flagZoom = true;
    }

    else if(type == 'r') {

	if (flagRot == false) {
	    flagRot = true;
	}
	else {
	    flagRot = false;
	}

	//cout<<"Old Matrix"<<endl;
	//curMatrix = SceneManager::instance()->getObjectTransform()->getMatrix();
	//curScale = SceneManager::instance()->getObjectScale();

//	printMat(curMatrix, curScale);

	
	/*osg::Matrix mat2 = */

        osg::Matrix rotM;	
	rotM.makeRotate(DegreesToRadians(1.0),osg::Vec3(0,1,0)); 
//	printMat(rotM, curScale);
	
	curMatrix= o2w * rotM * w2o;
	
  //      printMat(curMatrix, curScale);

	//curMatrix.setTrans(trans);
	//cout<<"New Matrix"<<endl;
	//printMat(curMatrix, curScale);
	cout<<"x = "<<origPlanetPoint[0]<<", y = "<<origPlanetPoint[1]<<", z = "<<origPlanetPoint[2]<<endl;

	osg::Matrix objMat = SceneManager::instance()->getObjectTransform()->getMatrix();

//.........这里部分代码省略.........
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:101,代码来源:CameraFlight.cpp


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