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 #include <sofa/component/constraint/OscillatorConstraint.inl> 00026 #include <sofa/core/ObjectFactory.h> 00027 #include <sofa/defaulttype/Vec3Types.h> 00028 #include <sofa/defaulttype/RigidTypes.h> 00029 //#include <sofa/helper/gl/Axis.h> 00030 #include <sstream> 00031 00032 namespace sofa 00033 { 00034 00035 namespace component 00036 { 00037 00038 namespace constraint 00039 { 00040 00041 using namespace sofa::defaulttype; 00042 using namespace sofa::helper; 00043 00044 //template <> 00045 //void OscillatorConstraint<RigidTypes>::draw() 00046 //{ 00048 // VecCoord& x = *mstate->getX(); 00049 // for (std::set<int>::const_iterator it = this->indices.begin(); it != this->indices.end(); ++it) 00050 // { 00051 // int i = *it; 00052 // Quat orient = x[i].getOrientation(); 00053 // RigidTypes::Vec3& center = x[i].getCenter(); 00054 // orient[3] = -orient[3]; 00055 // 00056 // static GL::Axis *axis = new GL::Axis(center, orient, 5); 00057 // 00058 // axis->update(center, orient); 00059 // axis->draw(); 00060 // }*/ 00061 // if (!getContext()->getShowBehaviorModels()) return; 00062 // VecCoord& x = *mstate->getX(); 00063 // glDisable (GL_LIGHTING); 00064 // glPointSize(10); 00065 // glColor4f (1,0.5,0.5,1); 00066 // glBegin (GL_POINTS); 00067 // for (std::set<int>::const_iterator it = this->indices.begin(); it != this->indices.end(); ++it) 00068 // { 00069 // helper::gl::glVertexT(x[0].getCenter()); 00070 // } 00071 // glEnd(); 00072 //} 00073 // 00074 //template <> 00075 // void OscillatorConstraint<RigidTypes>::projectResponse(VecDeriv& res) 00076 //{ 00077 // res[0] = Deriv(); 00078 //} 00079 00080 00081 SOFA_DECL_CLASS(OscillatorConstraint) 00082 00083 00084 int OscillatorConstraintClass = core::RegisterObject("Apply a sinusoidal trajectory to given points") 00085 #ifndef SOFA_FLOAT 00086 .add< OscillatorConstraint<Vec3dTypes> >() 00087 .add< OscillatorConstraint<Rigid3dTypes> >() 00088 #endif 00089 #ifndef SOFA_DOUBLE 00090 .add< OscillatorConstraint<Vec3fTypes> >() 00091 .add< OscillatorConstraint<Rigid3fTypes> >() 00092 #endif 00093 ; 00094 00095 #ifndef SOFA_FLOAT 00096 template class OscillatorConstraint<Rigid3dTypes>; 00097 template class OscillatorConstraint<Vec3dTypes>; 00098 #endif 00099 #ifndef SOFA_DOUBLE 00100 template class OscillatorConstraint<Rigid3fTypes>; 00101 template class OscillatorConstraint<Vec3fTypes>; 00102 #endif 00103 00104 } // namespace constraint 00105 00106 } // namespace component 00107 00108 } // namespace sofa 00109
1.5.7.1