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;
}
Example #2
0
Differentiator::Function& 
Differentiator::Function::setEstimatedAccuracy(Real ea) {
    SimTK_APIARGCHECK1_ALWAYS(0<ea&&ea<1, "Differentiator::Function", "setNumParameters",
        "The estimated accuracy was %g but must be between 0 and 1 (noninclusive)", ea);

    rep->estimatedAccuracy = ea;
    return *this;
}
Example #3
0
Differentiator::Function& 
Differentiator::Function::setNumParameters(int ny) {
    SimTK_APIARGCHECK1_ALWAYS(ny>=0, "Differentiator::Function", "setNumParameters",
        "The number of parameters was %d but must be >= 0", ny);

    rep->nParam = ny;
    return *this;
}
Example #4
0
Differentiator::Function& 
Differentiator::Function::setNumFunctions(int nf) {
    SimTK_APIARGCHECK1_ALWAYS(nf>=0, "Differentiator::Function", "setNumFunctions",
        "The number of functions was %d but must be >= 0", nf);

    rep->nFunc = nf;
    return *this;
}
Example #5
0
void PeriodicEventReporter::setEventInterval(Real eventInterval) {
    SimTK_APIARGCHECK1_ALWAYS(eventInterval > 0.0, "PeriodicEventReporter", "setEventInterval", "The interval was %d.  It must be > 0", eventInterval);
    impl->eventInterval = eventInterval;
}
Example #6
0
 PeriodicEventReporterImpl(Real eventInterval) : eventInterval(eventInterval) {
     SimTK_APIARGCHECK1_ALWAYS(eventInterval > 0.0, "PeriodicEventReporterImpl", "PeriodicEventReporterImpl", "The interval was %d.  It must be > 0", eventInterval);
 }