本文整理汇总了C++中MultibodySystem::updMatterSubsystem方法的典型用法代码示例。如果您正苦于以下问题:C++ MultibodySystem::updMatterSubsystem方法的具体用法?C++ MultibodySystem::updMatterSubsystem怎么用?C++ MultibodySystem::updMatterSubsystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultibodySystem
的用法示例。
在下文中一共展示了MultibodySystem::updMatterSubsystem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPlanarSystem
void createPlanarSystem(MultibodySystem& system) {
SimbodyMatterSubsystem& matter = system.updMatterSubsystem();
GeneralForceSubsystem forces(system);
Force::UniformGravity gravity(forces, matter, Vec3(0, -1, 0), 0);
Body::Rigid body(MassProperties(1.0, Vec3(0), Inertia(1)));
for (int i = 0; i < NUM_BODIES; ++i) {
MobilizedBody& parent = matter.updMobilizedBody(MobilizedBodyIndex(matter.getNumBodies()-1));
MobilizedBody::Planar b(parent, Transform(Vec3(0)), body, Transform(Vec3(BOND_LENGTH, 0, 0)));
}
}
示例2: extendAddToSystem
// Component interface implementation
void extendAddToSystem(MultibodySystem& system) const override {
if (system.hasMatterSubsystem()){
matter = system.updMatterSubsystem();
}
else{
// const Sub& subc = getMemberSubcomponent<Sub>(intSubix);
SimbodyMatterSubsystem* old_matter = matter.release();
delete old_matter;
matter = new SimbodyMatterSubsystem(system);
GeneralForceSubsystem* old_forces = forces.release();
delete old_forces;
forces = new GeneralForceSubsystem(system);
SimTK::Force::UniformGravity gravity(*forces, *matter, Vec3(0, -9.816, 0));
fix = gravity.getForceIndex();
system.updMatterSubsystem().setShowDefaultGeometry(true);
}
}
示例3: createCylinderSystem
void createCylinderSystem(MultibodySystem& system) {
SimbodyMatterSubsystem& matter = system.updMatterSubsystem();
GeneralForceSubsystem forces(system);
// Skew gravity so moving takes work.
Force::UniformGravity gravity(forces, matter, Vec3(0, -2, -3));
for (int i = 0; i < NUM_BODIES; ++i) {
MobilizedBody& parent =
matter.updMobilizedBody(MobilizedBodyIndex(matter.getNumBodies()-1));
const Real mass = 1 + 0.1*i;
Body::Rigid body(MassProperties(mass, Vec3(0), mass*UnitInertia(1)));
MobilizedBody::Cylinder b(parent, Transform(Vec3(.1,.2,.3)),
body, Transform(Vec3(BOND_LENGTH, 0, 0)));
}
}