SensAble.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 program is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU General Public License as published by the Free  *
00007 * Software Foundation; either version 2 of the License, or (at your option)   *
00008 * any later version.                                                          *
00009 *                                                                             *
00010 * This program 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 General Public License for    *
00013 * more details.                                                               *
00014 *                                                                             *
00015 * You should have received a copy of the GNU General Public License along     *
00016 * with this program; if not, write to the Free Software Foundation, Inc., 51  *
00017 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.                   *
00018 *******************************************************************************
00019 *                            SOFA :: Applications                             *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 #ifndef SOFA_CONTRIB_TESTING_SENSABLE_H
00028 #define SOFA_CONTRIB_TESTING_SENSABLE_H
00029 
00030 #include <iostream>
00031 
00032 #include <sofa/core/BehaviorModel.h>
00033 #include <sofa/core/VisualModel.h>
00034 #include <sofa/core/CollisionModel.h>
00035 #include <sofa/component/collision/SphereModel.h>
00036 #include <sofa/component/MechanicalObject.h>
00037 #include <sofa/core/objectmodel/Event.h>
00038 
00039 #include <sofa/defaulttype/VecTypes.h>
00040 #include <sofa/defaulttype/RigidTypes.h>
00041 #include <sofa/defaulttype/Mat.h>
00042 #include <sofa/defaulttype/Quat.h>
00043 #include <sofa/helper/Quater.h>
00044 
00045 using std::cout;
00046 
00047 class SensAble : public sofa::core::VisualModel, public sofa::core::BehaviorModel
00048 {
00049 
00050 public:
00051 
00052     SensAble();
00053     ~SensAble();
00054 
00055     // -- VisualModel interface
00056     void draw();
00057     void initTextures() { }
00058     void update() { }
00059 
00060     
00061     Data<sofa::defaulttype::Vec3d> translation;
00062     Data<sofa::defaulttype::Quat> rotation;
00063     Data<double> scale;
00064     Data<double> tipOffset;
00065     Data<sofa::defaulttype::RigidTypes::Coord> xform;
00066     Data<sofa::defaulttype::RigidTypes::Coord> xform2;
00067     Data<sofa::defaulttype::Vec3d> pivot;
00068     Data<bool> flip;
00069     Data<bool> bDraw;
00070     Data<char> key1; bool button1State;
00071     Data<char> key2; bool button2State;
00072 
00073     sofa::defaulttype::Mat3x3d mrotation;
00074 
00075     sofa::component::collision::SphereModel* sphereModel;
00076     sofa::component::MechanicalObject<sofa::defaulttype::RigidTypes>* rigidModel;
00077 
00078     // -- CollisionModel interface
00079 /*
00080     virtual std::vector<CollisionElement*> & getCollisionElements();
00081     virtual CollisionModel* getNext() { return sphereModel->getNext(); }
00082     virtual CollisionModel* getPrevious() { return sphereModel->getPrevious(); }
00083     virtual BehaviorModel* getObject() { return sphereModel->getObject(); }
00084 */
00085     // -- BehaviorModel interface (these would conflict with DynamicModel!)
00086     virtual void init();
00087 
00088     virtual void reinit();
00089 
00090     virtual void handleEvent(sofa::core::objectmodel::Event* event);
00091 
00093     virtual void updatePosition(double dt);
00094 
00095     sofa::defaulttype::Vector3 currentForce;
00096 };
00097 
00098 #endif

Generated on Sun Nov 23 02:28:35 2008 for Sofa by  doxygen 1.5.7.1