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


C++ Transform3d::transform方法代码示例

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


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

示例1: post_step_callback

// setup simulator callback
void post_step_callback(Simulator* s)
{
  const unsigned X = 0, Y = 1, Z = 2;

  // setup the sphere radius
  const double R = 1.0;

  // get the bottom of the sphere
  Transform3d wTs = Pose3d::calc_relative_pose(sphere->get_pose(), GLOBAL);

  shared_ptr<Pose3d> Pbot(new Pose3d);  
  Pbot->rpose = GLOBAL;
  Pbot->x = wTs.x;
  Pbot->x[Z] -= R;

  // get the velocity of the sphere at the contact point
  SVelocityd v = sphere->get_velocity();
  Transform3d botTv = Pose3d::calc_relative_pose(v.pose, Pbot);
  SVelocityd xd = botTv.transform(v);
  Vector3d linear = xd.get_linear();

/*
  SVelocityd v = sphere->get_velocity();
  Origin3d xd(v.get_linear());
  Origin3d omega(v.get_angular());
  Origin3d s(1.0, 0.0, 0.0);
  Origin3d t(0.0, 1.0, 0.0);
  Origin3d crosss = Origin3d::cross(-wTs.x, s);
  Origin3d crosst = Origin3d::cross(-wTs.x, t);
*/

  // output the sliding velocity at the contact 
  std::ofstream out("contactv.dat", std::ostream::app);
  out << sim->current_time << " " << linear[X] << " " << linear[Y] << " " << linear[Z] << std::endl;
//  out << sim->current_time << " " << (s.dot(xd) + crosss.dot(omega)) << " " << (t.dot(xd) + crosst.dot(omega)) << std::endl; 
//  out << sim->current_time << " " << v[3] << " " << v[4] << " " << v[5] << " " << v[0] << " " << v[1] << " " << v[2] << std::endl;
  out.close();

  out.open("velocity.dat", std::ostream::app);
  out << sim->current_time << " " << v[3] << " " << v[4] << " " << v[5] << " " << v[0] << " " << v[1] << " " << v[2] << std::endl; 
  out.close();

  out.open("ke.dat", std::ostream::app);
  out << sim->current_time << " " << sphere->calc_kinetic_energy() << std::endl;
  out.close();
}
开发者ID:constantineg1,项目名称:Moby,代码行数:47,代码来源:sphere-plugin.cpp


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