本文整理汇总了C++中Transformation::getDof方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::getDof方法的具体用法?C++ Transformation::getDof怎么用?C++ Transformation::getDof使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::getDof方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void FileInfoSkel<SkeletonType>::saveBodyNodeTree(BodyNode *_b, std::ofstream &_outfile, int _numLinks) const {
// save the current one
_outfile<<"\nnode "<<_b->getName()<<" { "<<_b->getSkelIndex()<<"\n";
// write the trans
_outfile<<"chain { "<<_b->getParentJoint()->getNumTransforms()<<"\n";
for(int i=0; i<_b->getParentJoint()->getNumTransforms(); i++){
Transformation *tr = _b->getParentJoint()->getTransform(i);
if(!tr->getVariable()){ // constant
if(tr->getType()==Transformation::T_TRANSLATE){
_outfile<<"telescope { <"<<tr->getDof(0)->getValue()<<", "<<tr->getDof(1)->getValue()<<", "<<tr->getDof(2)->getValue()<<">, "<<unitlength<<" }\n";
}
else if (tr->getType()==Transformation::T_ROTATEX){
_outfile<<"rotate_cons { "<<tr->getDof(0)->getValue()<<", "<<" x }\n";
}
else if (tr->getType()==Transformation::T_ROTATEY){
_outfile<<"rotate_cons { "<<tr->getDof(0)->getValue()<<", "<<" y }\n";
}
else if (tr->getType()==Transformation::T_ROTATEZ){
_outfile<<"rotate_cons { "<<tr->getDof(0)->getValue()<<", "<<" z }\n";
}
else {
_outfile<<"unknown trans\n";
}
}
else { // variable
if(tr->getType()==Transformation::T_TRANSLATE){
_outfile<<"translate { <"<<tr->getDof(0)->getName()<<", "<<tr->getDof(1)->getName()<<", "<<tr->getDof(2)->getName()<<"> }\n";
}
else if (tr->getType()==Transformation::T_ROTATEX){
_outfile<<"rotate_euler { "<<tr->getDof(0)->getName()<<", "<<" x }\n";
}
else if (tr->getType()==Transformation::T_ROTATEY){
_outfile<<"rotate_euler { "<<tr->getDof(0)->getName()<<", "<<" y }\n";
}
else if (tr->getType()==Transformation::T_ROTATEZ){
_outfile<<"rotate_euler { "<<tr->getDof(0)->getName()<<", "<<" z }\n";
}
else if (tr->getType()==Transformation::T_ROTATEEXPMAP){
_outfile<<"rotate_expmap { <"<<tr->getDof(0)->getName()<<", "<<tr->getDof(1)->getName()<<", "<<tr->getDof(2)->getName()<<"> }\n";
}
else {
_outfile<<"unknown trans\n";
}
}
}
_outfile<<"}\n"; // chain
// primitive
Eigen::Vector3d pdim = _b->getShape()->getDim(); // Default to VizShape in graphics context
Eigen::Vector3d off = _b->getLocalCOM();
_outfile<<"primitive { <"<<pdim[0]<<", "<<pdim[1]<<", "<<pdim[2]<<">, <"<<off[0]<<", "<<off[1]<<", "<<off[2]<<">, "<<unitlength;
// different types
Shape* prim = _b->getShape();
ShapeEllipsoid* elp = dynamic_cast<ShapeEllipsoid*>(prim);
ShapeBox* box = dynamic_cast<ShapeBox*>(prim);
if(elp) _outfile<<", SPHERE";
else if(box) _outfile<<", CUBE";
_outfile<<", "<<std::string(_b->getName())+std::string("_mass");
_outfile<<" }\n";
for(int i=0; i<_b->getNumChildJoints(); i++){
if(_b->getChildNode(i)->getSkelIndex()>=_numLinks) continue;
saveBodyNodeTree(_b->getChildNode(i), _outfile, _numLinks);
}
_outfile<<"}\n"; //node
}