Simbody  3.5
Constraint_LineOnLineContact.h
Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
00002 #define SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_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) 2014 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 //                         LINE ON LINE CONTACT
00036 //==============================================================================
00142 class SimTK_SIMBODY_EXPORT Constraint::LineOnLineContact
00143 :   public Constraint  {
00144 public:
00145     // no default constructor
00146 
00147 //------------------------------------------------------------------------------
00163 
00206 LineOnLineContact(  MobilizedBody&      mobod_F, 
00207                     const Transform&    defaultEdgeFrameF, 
00208                     Real                defaultHalfLengthF, 
00209                     MobilizedBody&      mobod_B, 
00210                     const Transform&    defaultEdgeFrameB, 
00211                     Real                defaultHalfLengthB, 
00212                     bool                enforceRolling);
00213     
00216 LineOnLineContact() {}
00217 
00221 const MobilizedBody& getMobilizedBodyF() const;
00222 
00226 const MobilizedBody& getMobilizedBodyB() const;
00227 
00231 bool isEnforcingRolling() const;
00232 
00237 LineOnLineContact& 
00238 setDefaultEdgeFrameF(const Transform& defaultEdgeFrameF);
00243 LineOnLineContact& 
00244 setDefaultHalfLengthF(Real defaultHalfLengthF);
00249 LineOnLineContact& 
00250 setDefaultEdgeFrameB(const Transform& defaultEdgeFrameB);
00255 LineOnLineContact& 
00256 setDefaultHalfLengthB(Real defaultHalfLengthF);
00257 
00262 const Transform& getDefaultEdgeFrameF() const;
00267 Real getDefaultHalfLengthF() const;
00268 
00273 const Transform& getDefaultEdgeFrameB() const;
00278 Real getDefaultHalfLengthB() const;
00281 //------------------------------------------------------------------------------
00289 // no controls yet
00293 //------------------------------------------------------------------------------
00311 
00318 const LineOnLineContact& 
00319 setEdgeFrameF(State& state, const Transform& edgeFrameF) const;
00320 
00324 const LineOnLineContact& 
00325 setHalfLengthF(State& state, Real halfLengthF) const;
00326 
00333 const LineOnLineContact& 
00334 setEdgeFrameB(State& state, const Transform& edgeFrameB) const;
00335 
00339 const LineOnLineContact& 
00340 setHalfLengthB(State& state, Real halfLengthB) const;
00341 
00345 const Transform& getEdgeFrameF(const State& state) const;
00349 Real getHalfLengthF(const State& state) const;
00350 
00354 const Transform& getEdgeFrameB(const State& state) const;
00358 Real getHalfLengthB(const State& state) const;
00361 //------------------------------------------------------------------------------
00371 Real getPositionError(const State& state) const;
00372 
00382 Vec3 getVelocityErrors(const State& state) const;
00383 
00389 Vec3 getAccelerationErrors(const State& state) const;
00390 
00401 Vec3 getMultipliers(const State& state) const;
00402 
00410 Vec3 findForceOnBodyBInG(const State& state) const;
00411 
00422 Transform findContactFrameInG(const State& state) const;
00423 
00432 void findClosestPointsInG(const State& state, Vec3& Qf, Vec3& Qb,
00433                           bool& linesAreParallel) const;
00434 
00442 Real findSeparation(const State& state) const; // hide from Doxygen
00446 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
00447     (LineOnLineContact, LineOnLineContactImpl, Constraint);
00449 };
00450 
00451 } // namespace SimTK
00452 
00453 #endif // SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
00454 
00455 
00456 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines