本文整理汇总了C++中MobilizedBody::updMatterSubsystem方法的典型用法代码示例。如果您正苦于以下问题:C++ MobilizedBody::updMatterSubsystem方法的具体用法?C++ MobilizedBody::updMatterSubsystem怎么用?C++ MobilizedBody::updMatterSubsystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MobilizedBody
的用法示例。
在下文中一共展示了MobilizedBody::updMatterSubsystem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Constraint
Constraint::SphereOnPlaneContact::SphereOnPlaneContact
(MobilizedBody& planeBody,
const Transform& defaultPlaneFrame,
MobilizedBody& sphereBody,
const Vec3& defaultSphereCenter,
Real defaultSphereRadius,
bool enforceRolling)
: Constraint(new SphereOnPlaneContactImpl(enforceRolling))
{
SimTK_APIARGCHECK_ALWAYS( planeBody.isInSubsystem()
&& sphereBody.isInSubsystem(),
"Constraint::SphereOnPlaneContact","SphereOnPlaneContact",
"Both bodies must already be in a SimbodyMatterSubsystem.");
SimTK_APIARGCHECK_ALWAYS(planeBody.isInSameSubsystem(sphereBody),
"Constraint::SphereOnPlaneContact","SphereOnPlaneContact",
"The two bodies to be connected must be in the same "
"SimbodyMatterSubsystem.");
SimTK_APIARGCHECK1_ALWAYS(defaultSphereRadius > 0,
"Constraint::SphereOnPlaneContact","SphereOnPlaneContact",
"The sphere radius must be greater than zero but was %g.",
defaultSphereRadius);
planeBody.updMatterSubsystem().adoptConstraint(*this);
updImpl().m_planeBody_F = updImpl().addConstrainedBody(planeBody);
updImpl().m_ballBody_B = updImpl().addConstrainedBody(sphereBody);
updImpl().m_def_X_FP = defaultPlaneFrame;
updImpl().m_def_p_BO = defaultSphereCenter;
updImpl().m_def_radius = defaultSphereRadius;
}
示例2: Constraint
Constraint::LineOnLineContact::LineOnLineContact
(MobilizedBody& mobod_F,
const Transform& defaultEdgeFrameF,
Real defaultHalfLengthF,
MobilizedBody& mobod_B,
const Transform& defaultEdgeFrameB,
Real defaultHalfLengthB,
bool enforceRolling)
: Constraint(new LineOnLineContactImpl(enforceRolling))
{
SimTK_APIARGCHECK_ALWAYS(mobod_F.isInSubsystem() && mobod_B.isInSubsystem(),
"Constraint::LineOnLineContact","LineOnLineContact",
"Both mobilized bodies must already be in a SimbodyMatterSubsystem.");
SimTK_APIARGCHECK_ALWAYS(mobod_F.isInSameSubsystem(mobod_B),
"Constraint::LineOnLineContact","LineOnLineContact",
"The two mobilized bodies to be connected must be in the same "
"SimbodyMatterSubsystem.");
mobod_F.updMatterSubsystem().adoptConstraint(*this);
updImpl().m_mobod_F = updImpl().addConstrainedBody(mobod_F);
updImpl().m_mobod_B = updImpl().addConstrainedBody(mobod_B);
updImpl().m_def_X_FEf = defaultEdgeFrameF;
updImpl().m_def_hf = defaultHalfLengthF;
updImpl().m_def_X_BEb = defaultEdgeFrameB;
updImpl().m_def_hb = defaultHalfLengthB;
}
示例3: Constraint
Constraint::SphereOnSphereContact::SphereOnSphereContact
(MobilizedBody& mobod_F,
const Vec3& defaultCenter_F,
Real defaultRadius_F,
MobilizedBody& mobod_B,
const Vec3& defaultCenter_B,
Real defaultRadius_B,
bool enforceRolling)
: Constraint(new SphereOnSphereContactImpl(enforceRolling))
{
SimTK_APIARGCHECK_ALWAYS(mobod_F.isInSubsystem() && mobod_B.isInSubsystem(),
"Constraint::SphereOnSphereContact","SphereOnSphereContact",
"Both mobilized bodies must already be in a SimbodyMatterSubsystem.");
SimTK_APIARGCHECK_ALWAYS(mobod_F.isInSameSubsystem(mobod_B),
"Constraint::SphereOnSphereContact","SphereOnSphereContact",
"The two mobilized bodies to be connected must be in the same "
"SimbodyMatterSubsystem.");
SimTK_APIARGCHECK2_ALWAYS(defaultRadius_F > 0 && defaultRadius_B > 0,
"Constraint::SphereOnSphereContact","SphereOnSphereContact",
"The sphere radii must be greater than zero; they were %g and %g.",
defaultRadius_F, defaultRadius_B);
mobod_F.updMatterSubsystem().adoptConstraint(*this);
updImpl().m_mobod_F = updImpl().addConstrainedBody(mobod_F);
updImpl().m_mobod_B = updImpl().addConstrainedBody(mobod_B);
updImpl().m_def_p_FSf = defaultCenter_F;
updImpl().m_def_radius_F = defaultRadius_F;
updImpl().m_def_p_BSb = defaultCenter_B;
updImpl().m_def_radius_B = defaultRadius_B;
}
示例4: MyConstraintImplementation
MyConstraintImplementation(MobilizedBody& mobilizer, Real speed)
: Implementation(mobilizer.updMatterSubsystem(), 0,1,0),
theMobilizer(), whichMobility(), prescribedSpeed(NaN)
{
theMobilizer = addConstrainedMobilizer(mobilizer);
whichMobility = MobilizerUIndex(0);
prescribedSpeed = speed;
}
示例5: ExampleConstraint
// Constructor takes two bodies and the desired separation distance
// between their body frame origins. Tell the base class that this
// constraint generates 1 holonomic (position level), 0 nonholonomic
// (velocity level), and 0 acceleration-only constraint equations.
ExampleConstraint(MobilizedBody& b1, MobilizedBody& b2, Real distance)
: Implementation(b1.updMatterSubsystem(), 1, 0, 0), distance(distance) {
body1 = addConstrainedBody(b1);
body2 = addConstrainedBody(b2);
}