本文整理汇总了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();
}