Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_MOBILIZED_BODY_PLANAR_H_ 00002 #define SimTK_SIMBODY_MOBILIZED_BODY_PLANAR_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-13 Stanford University and the Authors. * 00013 * Authors: Michael Sherman * 00014 * Contributors: Paul Mitiguy, Peter Eastman * 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/MobilizedBody.h" 00031 00032 namespace SimTK { 00033 00038 class SimTK_SIMBODY_EXPORT MobilizedBody::Planar : public MobilizedBody { 00039 public: 00042 Planar() {} 00043 00049 Planar(MobilizedBody& parent, const Transform& X_PF, 00050 const Body& bodyInfo, const Transform& X_BM, Direction=Forward); 00051 00054 Planar(MobilizedBody& parent, const Body& bodyInfo, Direction=Forward); 00055 00056 Planar& addBodyDecoration(const Transform& X_BD, const DecorativeGeometry& g) { 00057 (void)MobilizedBody::addBodyDecoration(X_BD,g); return *this; 00058 } 00059 Planar& addOutboardDecoration(const Transform& X_MD, const DecorativeGeometry& g) { 00060 (void)MobilizedBody::addOutboardDecoration(X_MD,g); return *this; 00061 } 00062 Planar& addInboardDecoration (const Transform& X_FD, const DecorativeGeometry& g) { 00063 (void)MobilizedBody::addInboardDecoration(X_FD,g); return *this; 00064 } 00065 00066 Planar& setDefaultInboardFrame(const Transform& X_PF) { 00067 (void)MobilizedBody::setDefaultInboardFrame(X_PF); return *this; 00068 } 00069 00070 Planar& setDefaultOutboardFrame(const Transform& X_BM) { 00071 (void)MobilizedBody::setDefaultOutboardFrame(X_BM); return *this; 00072 } 00073 00074 // Friendly, mobilizer-specific access to coordinates and speeds. 00075 Planar& setDefaultAngle(Real a) { 00076 Vec3 q = getDefaultQ(); q[0] = a; setDefaultQ(q); 00077 return *this; 00078 } 00079 Planar& setDefaultTranslation(const Vec2& r) { 00080 Vec3 q = getDefaultQ(); q.updSubVec<2>(1) = r; setDefaultQ(q); 00081 return *this; 00082 } 00083 00084 Real getDefaultAngle() const {return getDefaultQ()[0];} 00085 const Vec2& getDefaultTranslation() const {return getDefaultQ().getSubVec<2>(1);} 00086 00087 void setAngle (State& s, Real a) {setOneQ(s,0,a);} 00088 void setTranslation(State& s, const Vec2& r) {setOneQ(s,1,r[0]); setOneQ(s,2,r[1]);} 00089 00090 Real getAngle(const State& s) const {return getQ(s)[0];} 00091 const Vec2& getTranslation(const State& s) const {return getQ(s).getSubVec<2>(1);} 00092 00093 // Generic default state Topology methods. 00094 const Vec3& getDefaultQ() const; 00095 Planar& setDefaultQ(const Vec3& q); 00096 00097 const Vec3& getQ(const State&) const; 00098 const Vec3& getQDot(const State&) const; 00099 const Vec3& getQDotDot(const State&) const; 00100 const Vec3& getU(const State&) const; 00101 const Vec3& getUDot(const State&) const; 00102 00103 void setQ(State&, const Vec3&) const; 00104 void setU(State&, const Vec3&) const; 00105 00106 const Vec3& getMyPartQ(const State&, const Vector& qlike) const; 00107 const Vec3& getMyPartU(const State&, const Vector& ulike) const; 00108 00109 Vec3& updMyPartQ(const State&, Vector& qlike) const; 00110 Vec3& updMyPartU(const State&, Vector& ulike) const; 00111 // Don't let doxygen see this 00113 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Planar, PlanarImpl, MobilizedBody); 00115 }; 00116 00117 } // namespace SimTK 00118 00119 #endif // SimTK_SIMBODY_MOBILIZED_BODY_PLANAR_H_ 00120 00121 00122