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


C++ Transforms::translate方法代码示例

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


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

示例1: if

Handle<Value> Transforms_Translate(const Arguments& args)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(args.This());
    assert(ptr);

    if (((args.Length() == 1) || (args.Length() == 2)) && isJSVector3(args[0]))
    {
        Vector3 d = fromJSVector3Unsafe(args[0]);

        Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
        if ((args.Length() == 2) && args[1]->IsUint32())
            relativeTo = (Transforms::tTransformSpace) args[1]->Uint32Value();

        ptr->translate(d, relativeTo);

        return Handle<Value>();
    }
    else if (((args.Length() == 3) || (args.Length() == 4)) &&
             args[0]->IsNumber() && args[1]->IsNumber() && args[2]->IsNumber())
    {
        Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
        if ((args.Length() == 4) && args[3]->IsUint32())
            relativeTo = (Transforms::tTransformSpace) args[3]->Uint32Value();

        ptr->translate(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), relativeTo);

        return Handle<Value>();
    }

    return ThrowException(String::New("Invalid parameters, syntax: translate(vector3 [, transform_space]) or translate(dx, dy, dz [, transform_space])"));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:33,代码来源:Transforms.cpp

示例2: setWorldTransform

void Body::setWorldTransform(const btTransform& worldTrans)
{
    Transforms* pTransforms = getTransforms();
    if (pTransforms)
    {
        pTransforms->translate(fromBullet(worldTrans.getOrigin()) - pTransforms->getWorldPosition(), Transforms::TS_WORLD);

        if (m_bRotationEnabled)
            pTransforms->rotate(pTransforms->getWorldOrientation().rotationTo(fromBullet(worldTrans.getRotation())), Transforms::TS_WORLD);
    }
}
开发者ID:Kanma,项目名称:Athena-Physics,代码行数:11,代码来源:Body.cpp

示例3: transformCoiledCoil

void transformCoiledCoil(AtomPointerVector& _chainA, AtomPointerVector& _chainB,double _zShiftA,double _zShiftB,double _crossingAngle, double _axialRotateA,double _axialRotateB,double _xShift,Transforms& _trans,CartesianPoint& _origin, CartesianPoint& _zAxis, CartesianPoint& _xAxis, AtomPointerVector& _axisA, AtomPointerVector& _axisB) {
	//====== Z Shift (Crossing Point) ======
	CartesianPoint zShiftACP(0.0, 0.0, _zShiftA);
	_trans.translate(_chainA, zShiftACP);

	CartesianPoint zShiftBCP(0.0, 0.0, _zShiftB);
	_trans.translate(_chainB, zShiftBCP);

	//===== Axial Rotation ======
	_trans.rotate(_chainA, _axialRotateA, _origin, _zAxis);
	_trans.rotate(_chainB, _axialRotateB, _origin, _zAxis);

	//====== Local Crossing Angle ======
	_trans.rotate(_chainA, (_crossingAngle/2.0), _origin, _xAxis);
	_trans.rotate(_axisA,  (_crossingAngle/2.0), _origin, _xAxis);

	_trans.rotate(_chainB, (_crossingAngle/2.0), _origin, _xAxis);
	_trans.rotate(_axisB,  (_crossingAngle/2.0), _origin, _xAxis);

	//====== X shift (Interhelical Distance) =======
	CartesianPoint interDistVect;
	interDistVect.setCoor((_xShift/2.0) * -1.0, 0.0, 0.0);
	_trans.translate(_chainA, interDistVect);
	_trans.translate(_axisA, interDistVect);

	interDistVect.setCoor((_xShift/2.0) * -1.0, 0.0, 0.0);
	_trans.translate(_chainB, interDistVect);
	_trans.translate(_axisB, interDistVect);

	// Rotation matrix for 180 degrees

	Matrix m(3,3,0.0);
	m[0][0] = -1.0;
	m[0][1] = 0.0;
	m[0][2] = 0.0;
	m[1][0] = 0.0;
	m[1][1] = -1.0;
	m[1][2] = 0.0;
	m[2][0] = 0.0;
	m[2][1] = 0.0;
	m[2][2] = 1.0;

	// Rotate chain B around Z axis
	Transforms trans; 
	trans.rotate(_chainB, m);
	trans.rotate(_axisB, m);

}
开发者ID:Suncuss,项目名称:mslib,代码行数:48,代码来源:genHeteroUniverse.cpp

示例4: main

int main(int argc, char *argv[]){
	// Option Parser
	Options opt = setupOptions(argc,argv);
	Transforms tr;

	// Super-helical Radius Loop
	for (double sr = opt.superHelicalRadius[0]; sr <= opt.superHelicalRadius[1]; sr += opt.superHelicalRadius[2]){

		// Alpha-helical Phase Angle Loop
		for (double aph = opt.alphaHelicalPhaseAngle[0]; aph < opt.alphaHelicalPhaseAngle[1];aph+=opt.alphaHelicalPhaseAngle[2]){

		  // Super-helical Pitch Angle loop added by David Slochower
		  for(double shpa = opt.superHelicalPitchAngle[0]; shpa < opt.superHelicalPitchAngle[1]; shpa+=opt.superHelicalPitchAngle[2]) {
		    double shPitch = (2*M_PI*sr)/tan(M_PI*shpa/180);

			// Generate a coiled helix
			CoiledCoils cc;
			// Values used for previous work: cc.northCoiledCoils(sr, 1.5232, shPitch, 2.25, opt.numberOfResidues, 103.195, aph);
			// March 31, 2010: Jason Donald
			// Hard code values of h (rise/residue) = 1.51, r1 (alpha-helical radius), and theta (alpha helical frequency)
                        // based on median values observed by Gevorg Grigoryan
			//cc.northCoiledCoils(sr, 1.51, shPitch, 2.26, opt.numberOfResidues, 102.8, aph);
			
			AtomPointerVector coil = cc.getCoiledCoil(sr, 1.51, shPitch, 2.26, 102.8, aph, 0.0,opt.numberOfResidues); 

			// Apply symmetry operations to create a bundle
			int C_axis = atoi(opt.symmetry.substr(1,(opt.symmetry.length()-1)).c_str());
			if (opt.symmetry.substr(0,1) == "C"){
				Symmetry sym;
				sym.applyCN(coil,C_axis);
	
				// Write out bundle
				char filename[80];
				sprintf(filename, "%s_%s_%03d_%05.2f_%05.2f_shp%05.2f.pdb", opt.name.c_str(),opt.symmetry.c_str(),opt.numberOfResidues, sr, aph, shpa);
			
				cout << "Writing "<<filename<<endl;
				PDBWriter pout;
				pout.open(filename);
				pout.write(sym.getAtomPointers());
				pout.close();
			}	
			else if (opt.symmetry.substr(0,1) == "D"){
				// Z Rotate 
				for (double spa = opt.superHelicalPhaseAngle[0]; spa < opt.superHelicalPhaseAngle[1]; spa += opt.superHelicalPhaseAngle[2]){
					coil.clearSavedCoor();
					coil.saveCoor("preSPA");

					Matrix zRot = CartesianGeometry::getZRotationMatrix(spa);
					//coil.rotate(zRot);
					tr.rotate(coil, zRot);
					
					// Z Trans
					for (double ztrans = opt.d2zTranslation[0];ztrans < opt.d2zTranslation[1]; ztrans += opt.d2zTranslation[2]){
						coil.saveCoor("preZtrans");

						CartesianPoint z(0,0,ztrans);
						//coil.translate(z);
						tr.translate(coil, z);

						Symmetry sym;
						sym.applyDN(coil,C_axis);
								
						// Write out bundle
						char filename[80];
						sprintf(filename, "%s_%s_%03d_%05.2f_%05.2f_shp%05.2f_%05.2f_%05.2f.pdb", opt.name.c_str(),opt.symmetry.c_str(),opt.numberOfResidues,sr, aph, shpa, spa, ztrans);
			
						cout << "Writing "<<filename<<endl;
						PDBWriter pout;
						pout.open(filename);
						pout.write(sym.getAtomPointers());
						pout.close();

						coil.applySavedCoor("preZtrans");
					} // Ztrans
					coil.applySavedCoor("preSPA");
				} // SHA
			} 
                }
           }
	}
}
开发者ID:Suncuss,项目名称:mslib,代码行数:81,代码来源:generateCoiledCoils.cpp


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