Simbody  3.5
Constraint_Rod.h
Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_CONSTRAINT_ROD_H_
00002 #define SimTK_SIMBODY_CONSTRAINT_ROD_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                               Simbody(tm)                                  *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
00011  *                                                                            *
00012  * Portions copyright (c) 2007-14 Stanford University and the Authors.        *
00013  * Authors: Michael Sherman                                                   *
00014  * Contributors:                                                              *
00015  *                                                                            *
00016  * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
00017  * not use this file except in compliance with the License. You may obtain a  *
00018  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
00019  *                                                                            *
00020  * Unless required by applicable law or agreed to in writing, software        *
00021  * distributed under the License is distributed on an "AS IS" BASIS,          *
00022  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
00023  * See the License for the specific language governing permissions and        *
00024  * limitations under the License.                                             *
00025  * -------------------------------------------------------------------------- */
00026 
00030 #include "simbody/internal/Constraint.h"
00031 
00032 namespace SimTK {
00033 
00034 //==============================================================================
00035 //                  ROD (CONSTANT DISTANCE) CONSTRAINT
00036 //==============================================================================
00037 
00052 class SimTK_SIMBODY_EXPORT Constraint::Rod : public Constraint {
00053 public:
00054     // no default constructor
00055 
00056 //------------------------------------------------------------------------------
00093 Rod(MobilizedBody& mobod1, const Vec3& defaultPointOnBody1,
00094     MobilizedBody& mobod2, const Vec3& defaultPointOnBody2,
00095     Real defaultRodLength);
00096 
00115 Rod(MobilizedBody& mobod1, MobilizedBody& mobod2,
00116     Real defaultRodLength);
00117 
00120 Rod() {}
00121 
00124 const MobilizedBody& getMobilizedBody1() const;
00125 
00128 const MobilizedBody& getMobilizedBody2() const;
00129 
00134 Rod& setDefaultPointOnBody1(const Vec3& defaultPoint);
00139 Rod& setDefaultPointOnBody2(const Vec3& defaultPoint);
00144 Rod& setDefaultRodLength(Real defaultRodLength);
00145 
00150 const Vec3& getDefaultPointOnBody1() const;
00155 const Vec3& getDefaultPointOnBody2() const;
00159 Real getDefaultRodLength() const;
00162 //------------------------------------------------------------------------------
00174     // nothing yet
00177 //------------------------------------------------------------------------------
00201 const Rod& setPointOnBody1(State& state, const Vec3& p_B1P) const;
00208 const Rod& setPointOnBody2(State& state, const Vec3& p_B2Q) const;
00213 const Rod& setRodLength(State& state, Real rodLength) const;
00219 const Vec3& getPointOnBody1(const State& state) const;
00225 const Vec3& getPointOnBody2(const State& state) const;
00228 Real getRodLength(const State& state) const;
00231 //------------------------------------------------------------------------------
00240 Real getPositionError(const State&) const;
00241 
00245 Real getVelocityError(const State&) const;
00246 
00248 Real getAccelerationError(const State&) const;
00249 
00255 Real getMultiplier(const State&) const;
00256 
00261 Real getRodTension(const State&) const;
00262 
00268 UnitVec3 findRodOrientationInG(const State& state) const;
00269 
00276 Real findLengthViolation(const State& state) const;
00277 
00280 //------------------------------------------------------------------------------
00285 MobilizedBodyIndex getBody1MobilizedBodyIndex() const;
00287 MobilizedBodyIndex getBody2MobilizedBodyIndex() const; // hide from Doxygen
00291 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Rod, RodImpl, Constraint);
00293 };
00294 
00295 } // namespace SimTK
00296 
00297 #endif // SimTK_SIMBODY_CONSTRAINT_ROD_H_
00298 
00299 
00300 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines