Simbody 3.7
Constraint_LineOnLineContact.h
Go to the documentation of this file.
1#ifndef SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
2#define SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
3
4/* -------------------------------------------------------------------------- *
5 * Simbody(tm) *
6 * -------------------------------------------------------------------------- *
7 * This is part of the SimTK biosimulation toolkit originating from *
8 * Simbios, the NIH National Center for Physics-Based Simulation of *
9 * Biological Structures at Stanford, funded under the NIH Roadmap for *
10 * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11 * *
12 * Portions copyright (c) 2014 Stanford University and the Authors. *
13 * Authors: Michael Sherman *
14 * Contributors: *
15 * *
16 * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17 * not use this file except in compliance with the License. You may obtain a *
18 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19 * *
20 * Unless required by applicable law or agreed to in writing, software *
21 * distributed under the License is distributed on an "AS IS" BASIS, *
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23 * See the License for the specific language governing permissions and *
24 * limitations under the License. *
25 * -------------------------------------------------------------------------- */
26
31
32namespace SimTK {
33
34//==============================================================================
35// LINE ON LINE CONTACT
36//==============================================================================
143: public Constraint {
144public:
145 // no default constructor
146
147//------------------------------------------------------------------------------
163
207 const Transform& defaultEdgeFrameF,
208 Real defaultHalfLengthF,
209 MobilizedBody& mobod_B,
210 const Transform& defaultEdgeFrameB,
211 Real defaultHalfLengthB,
212 bool enforceRolling);
213
217
222
227
232
238setDefaultEdgeFrameF(const Transform& defaultEdgeFrameF);
244setDefaultHalfLengthF(Real defaultHalfLengthF);
250setDefaultEdgeFrameB(const Transform& defaultEdgeFrameB);
256setDefaultHalfLengthB(Real defaultHalfLengthF);
257
268
281//------------------------------------------------------------------------------
289// no controls yet
293//------------------------------------------------------------------------------
311
318const LineOnLineContact&
319setEdgeFrameF(State& state, const Transform& edgeFrameF) const;
320
324const LineOnLineContact&
325setHalfLengthF(State& state, Real halfLengthF) const;
326
333const LineOnLineContact&
334setEdgeFrameB(State& state, const Transform& edgeFrameB) const;
335
339const LineOnLineContact&
340setHalfLengthB(State& state, Real halfLengthB) const;
341
345const Transform& getEdgeFrameF(const State& state) const;
349Real getHalfLengthF(const State& state) const;
350
354const Transform& getEdgeFrameB(const State& state) const;
358Real getHalfLengthB(const State& state) const;
361//------------------------------------------------------------------------------
371Real getPositionError(const State& state) const;
372
382Vec3 getVelocityErrors(const State& state) const;
383
389Vec3 getAccelerationErrors(const State& state) const;
390
401Vec3 getMultipliers(const State& state) const;
402
410Vec3 findForceOnBodyBInG(const State& state) const;
411
423
432void findClosestPointsInG(const State& state, Vec3& Qf, Vec3& Qb,
433 bool& linesAreParallel) const;
434
442Real findSeparation(const State& state) const; // hide from Doxygen
447 (LineOnLineContact, LineOnLineContactImpl, Constraint);
449};
450
451} // namespace SimTK
452
453#endif // SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
454
455
456
This defines the base Constraint class and related classes, which are used to specify limitations on ...
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This constraint represents a bilateral connection between an edge on one body and a non-parallel edge...
Definition: Constraint_LineOnLineContact.h:143
Real findSeparation(const State &state) const
Calculate the separation distance or penetration depth of the two edges.
LineOnLineContact(MobilizedBody &mobod_F, const Transform &defaultEdgeFrameF, Real defaultHalfLengthF, MobilizedBody &mobod_B, const Transform &defaultEdgeFrameB, Real defaultHalfLengthB, bool enforceRolling)
Construct a line-on-line constraint as described in the Constraint::LineOnLineContact class documenta...
Vec3 getVelocityErrors(const State &state) const
The returned velocity error vector has the time derivative of the quantity returned by getPositionErr...
const Transform & getDefaultEdgeFrameF() const
Return the default frame of the edge attached to the first body, mobod_F, as set during construction ...
bool isEnforcingRolling() const
Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frict...
Real getPositionError(const State &state) const
The returned position error can be viewed as the signed distance between the lines.
LineOnLineContact & setDefaultHalfLengthF(Real defaultHalfLengthF)
Replace the default half-length for the edge attached to the first body, mobod_F, that was supplied o...
const LineOnLineContact & setHalfLengthF(State &state, Real halfLengthF) const
Modify the half-length hf of the edge on the first body, mobod_F, in this state.
LineOnLineContact & setDefaultEdgeFrameB(const Transform &defaultEdgeFrameB)
Replace the default frame of the edge attached to the second body, mobod_B, that was supplied on cons...
LineOnLineContact()
Default constructor creates an empty handle that can be used to reference any LineOnLineContact Const...
Definition: Constraint_LineOnLineContact.h:216
Vec3 getMultipliers(const State &state) const
These are the Lagrange multipliers required to enforce the constraint equations generated here.
const Transform & getDefaultEdgeFrameB() const
Return the default frame of the edge attached to the second body, mobod_B, as set during construction...
Real getDefaultHalfLengthB() const
Return the default half-length for the edge attached to the second body, mobod_B, as set during const...
Real getDefaultHalfLengthF() const
Return the default half-length for the edge attached to the first body, mobod_F, as set during constr...
const MobilizedBody & getMobilizedBodyF() const
Return a reference to the first MobilizedBody to which a line is attached.
Vec3 findForceOnBodyBInG(const State &state) const
Return the force vector currently being applied by this constraint to the point of body B that is coi...
Real getHalfLengthB(const State &state) const
Return the half-length of the edge Eb on the second body, mobod_B, as currently set in the given stat...
Vec3 getAccelerationErrors(const State &state) const
This vector is the time derivative of the value returned by getVelocityError().
const Transform & getEdgeFrameF(const State &state) const
Return the frame of the edge Ef on the first body, mobod_F, as currently set in the given state.
const Transform & getEdgeFrameB(const State &state) const
Return the frame of the edge Eb on the second body, mobod_B, as currently set in the given state.
const LineOnLineContact & setEdgeFrameF(State &state, const Transform &edgeFrameF) const
Modify the frame of the edge on the first body, mobod_F, in this state by providing a new Transform X...
LineOnLineContact & setDefaultHalfLengthB(Real defaultHalfLengthF)
Replace the default half-length for the edge attached to the second body, mobod_B,...
const LineOnLineContact & setEdgeFrameB(State &state, const Transform &edgeFrameB) const
Modify the frame of the edge on the second body, mobod_B, in this state by providing a new Transform ...
const MobilizedBody & getMobilizedBodyB() const
Return a reference to the second MobilizedBody to which a line is attached.
Real getHalfLengthF(const State &state) const
Return the half-length of the edge Ef on the first body, mobod_F, as currently set in the given state...
Transform findContactFrameInG(const State &state) const
Return the instantaneous contact frame C in the Ground frame.
const LineOnLineContact & setHalfLengthB(State &state, Real halfLengthB) const
Modify the half-length hb of the edge on the second body, mobod_B, in this state.
LineOnLineContact & setDefaultEdgeFrameF(const Transform &defaultEdgeFrameF)
Replace the default frame of the edge attached to the first body, mobod_F, that was supplied on const...
void findClosestPointsInG(const State &state, Vec3 &Qf, Vec3 &Qb, bool &linesAreParallel) const
Calculate the closest points on each of the two lines, measured and expressed in Ground.
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:67
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606