PMLRigidBody.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 
00026 /***************************************************************************
00027  *                                                                         *
00028  *   This program is free software; you can redistribute it and/or modify  *
00029  *   it under the terms of the GNU General Public License as published by  *
00030  *   the Free Software Foundation; either version 2 of the License, or     *
00031  *   (at your option) any later version.                                   *
00032  *                                                                         *
00033  ***************************************************************************/
00034 
00035 //-------------------------------------------------------------------------
00036 //                      --   Description   --
00037 //  PMLRigidBody translate an indeformable object from Physical Model structure 
00038 //  to sofa structure. 
00039 //  It inherits from PMLBody abstract class.
00040 //-------------------------------------------------------------------------
00041 
00042 
00043 #ifndef PMLRIGIDBODY_H
00044 #define PMLRIGIDBODY_H
00045 
00046 #include "PMLBody.h"
00047 
00048 #include <StructuralComponent.h>
00049 
00050 #include "sofa/component/MechanicalObject.h"
00051 #include "sofa/defaulttype/RigidTypes.h"
00052 #include "sofa/defaulttype/Quat.h"
00053 
00054 
00055 #include <map>
00056 
00057 
00058 namespace sofa
00059 {
00060 
00061 namespace filemanager
00062 {
00063 
00064 namespace pml
00065 {
00066 
00067 using namespace sofa::defaulttype;
00068 using namespace std;
00069 
00070 class PMLRigidBody: public PMLBody
00071 {
00072 public :
00073 
00074     PMLRigidBody(StructuralComponent* body, GNode * parent);
00075 
00076     ~PMLRigidBody();
00077 
00078     string isTypeOf() { return "rigid"; }
00079 
00081     bool FusionBody(PMLBody*);
00082 
00083     Vector3 getDOF(unsigned int index);
00084 
00085     GNode* getPointsNode() {return VisualNode;}
00086 
00087     MechanicalObject<RigidTypes> * getRefDOF() { return refDOF;}
00088 
00090     bool bodyFixed;
00091 
00092 
00093 private :
00094 
00096     void createMechanicalState(StructuralComponent* body);
00097     void createTopology(StructuralComponent* body);
00098     void createMass(StructuralComponent* body);
00099     void createVisualModel(StructuralComponent* body);
00100     void createForceField(){}
00101     void createCollisionModel();
00102 
00104     void initMass(string m);
00105     void initInertiaMatrix(string m);
00106     void initPosition(string m);
00107     void initVelocity(string m);
00108 
00109 
00111     MechanicalObject<RigidTypes> * refDOF;
00113     BaseMapping * mapping;
00115     GNode * VisualNode;
00117     GNode * CollisionNode;
00119     Vector3 bary;
00120 
00121     //members for the mass (only one of the 2 vectors is filled)
00122     std::vector<SReal> massList;
00123     std::vector<SReal> inertiaMatrix;
00124      
00125     //members coding for the position 
00126     Vector3 transPos;
00127     Quat rotPos;
00128 
00129     //members coding for the velocity
00130     Vector3 transVel;
00131     Vector3 rotVel;
00132 
00133 };
00134 
00135 }
00136 }
00137 }
00138 
00139 #endif
00140 

Generated on Sun Nov 23 03:56:16 2008 for Sofa by  doxygen 1.5.7.1