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


C++ MultibodySystem::updMatterSubsystem方法代码示例

本文整理汇总了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)));
    }
}
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:10,代码来源:TestCustomConstraints.cpp

示例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);
        }
    }
开发者ID:wagglefoot,项目名称:opensim-core,代码行数:22,代码来源:testComponentInterface.cpp

示例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)));
    }
}
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:14,代码来源:TestCustomConstraints.cpp


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