本文整理汇总了C++中Station::findLocationInFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Station::findLocationInFrame方法的具体用法?C++ Station::findLocationInFrame怎么用?C++ Station::findLocationInFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Station
的用法示例。
在下文中一共展示了Station::findLocationInFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testStationOnFrame
void testStationOnFrame()
{
SimTK::Vec3 tolerance(SimTK::Eps);
cout << "Running testStationOnFrame" << endl;
Model* pendulum = new Model("double_pendulum.osim");
// Get "rod1" frame
const OpenSim::Body& rod1 = pendulum->getBodySet().get("rod1");
const SimTK::Vec3& com = rod1.get_mass_center();
// Create station aligned with rod1 com in rod1_frame
Station* myStation = new Station();
myStation->set_location(com);
myStation->updConnector<PhysicalFrame>("reference_frame")
.set_connectee_name("rod1");
pendulum->addModelComponent(myStation);
// myStation should coincide with com location of rod1 in ground
SimTK::State& s = pendulum->initSystem();
for (double ang = 0; ang <= 90.0; ang += 10.){
double radAngle = SimTK::convertDegreesToRadians(ang);
const Coordinate& coord = pendulum->getCoordinateSet().get("q1");
coord.setValue(s, radAngle);
SimTK::Vec3 comInGround =
myStation->findLocationInFrame(s, pendulum->getGround());
SimTK::Vec3 comBySimbody =
rod1.getMobilizedBody().findStationLocationInGround(s, com);
ASSERT_EQUAL(comInGround, comBySimbody, tolerance, __FILE__, __LINE__,
"testStationOnFrame(): failed to resolve station position in ground.");
}
}