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


C++ SimObj::getSize方法代码示例

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


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

示例1: onAction


//.........这里部分代码省略.........

  // if (netVelocityTarget > 0.1 )

  // {

  //   double angle = atan ( (targetPos.z() - startPosition.z()) / (targetPos.x() - startPosition.x()  )  ) * 180 / PI;
  //   cout << "The angle is" << angle; 
  //   storePosition(targetPos);
  // }



  std::vector<std::string> s;

  for(std::map<std::string, CParts *>::iterator it = stick->getPartsCollection().begin(); it != stick->getPartsCollection().end(); ++it){
    if (it->first != "body")
        s.push_back(it->first);
    }
  
 std::string linkName; 
 Size si;

 cout << "The total links are  " << s.size() << endl;

 for (int i = 0; i < s.size(); i++){

  const char* linkName = s[i].c_str();
  CParts *link = stick->getParts(linkName);
  link->getPosition(pos);
  link->getRotation(linkRotation);

  if (link->getType() == 0){
            BoxParts* box = (BoxParts*) link;
            si = box->getSize();
            // cout <<  linkName << endl;
            cout << linkName << "  position : x = " << pos.x() << "  y = " << pos.y() << "  z = " << pos.z() << endl;
            // cout << linkName << "  size : x = " << si.x() << "  y = " << si.y() << "  z = " << si.z() << endl;
            // cout << linkName << "  Rotation: qw " << linkRotation.qw() << " qx = "<< linkRotation.qx() << " qy = "<< linkRotation.qy()
            // << " qz = "<< linkRotation.qz() << endl;

            try{  

               py::object main_module = py::import("__main__");
               py::object main_namespace = main_module.attr("__dict__");  
               main_module.attr("linkName") = linkName;
               main_module.attr("length")  = si.x();
               main_module.attr("height")  = si.y();
               main_module.attr("breadth") = si.z();
               main_module.attr("linkPos") = "[" + tostr(pos.x())+" , "+ tostr(pos.y())+ " , " + tostr(pos.z()) + "]";
               main_module.attr("rotation") = "[" + tostr(linkRotation.qw())+" , "+ tostr(linkRotation.qx())+ " , " + tostr(linkRotation.qy()) + " , " + tostr(linkRotation.qz()) +"]";
               
               // calculating the rotation of the tool.
               py::exec("import ast", main_namespace);
               py::exec("import transformations as T", main_namespace);
               py::exec("rotation = ast.literal_eval(rotation)", main_namespace);
               // py::exec("angles = T.euler_from_quaternion(rotation) ", main_namespace);
               // py::exec("print angles", main_namespace);

    
             
               py::exec("linkPos = ast.literal_eval(linkPos)", main_namespace);
               py::exec_file("vertices.py", main_namespace, main_namespace );
               py::exec("getNormals(linkName, linkPos, rotation, length, height, breadth)", main_namespace);

               main_module.attr("targetPos") = "[" + tostr(targetPos.x())+" , "+ tostr(targetPos.y())+ " , " + tostr(targetPos.z()) + "]";
               main_module.attr("displacementVect") = "[" + tostr(displacementVect.x())+" , "+ tostr(displacementVect.y())+ " , " + tostr(displacementVect.z()) + "]";
开发者ID:raghavendrajain,项目名称:generalization,代码行数:67,代码来源:LToolController.cpp


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