本文整理汇总了C++中Transforms::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transforms::rotate方法的具体用法?C++ Transforms::rotate怎么用?C++ Transforms::rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transforms
的用法示例。
在下文中一共展示了Transforms::rotate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例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);
}
}
示例3: if
Handle<Value> Transforms_Rotate(const Arguments& args)
{
HandleScope handle_scope;
Transforms* ptr = GetPtr(args.This());
assert(ptr);
if (isJSVector3(args[0]))
{
if (args[1]->IsNumber())
{
Vector3 axis = fromJSVector3Unsafe(args[0]);
Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
if ((args.Length() == 3) && args[2]->IsUint32())
relativeTo = (Transforms::tTransformSpace) args[2]->Uint32Value();
ptr->rotate(axis, Radian(args[1]->NumberValue()), relativeTo);
return Handle<Value>();
}
}
else if (isJSQuaternion(args[0]))
{
Quaternion q = fromJSQuaternionUnsafe(args[0]);
Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
if ((args.Length() == 2) && args[1]->IsUint32())
relativeTo = (Transforms::tTransformSpace) args[1]->Uint32Value();
ptr->rotate(q, relativeTo);
return Handle<Value>();
}
return ThrowException(String::New("Invalid parameters, syntax: rotate(axis, angle [, relativeTo]) or rotate(quaternion [, relativeTo])"));
}
示例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
}
}
}
}
}