TubularMapping.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SOFA_COMPONENT_MAPPING_TUBULARMAPPING_H
00026 #define SOFA_COMPONENT_MAPPING_TUBULARMAPPING_H
00027
00028 #include <sofa/core/componentmodel/behavior/MechanicalMapping.h>
00029 #include <sofa/core/componentmodel/behavior/MechanicalState.h>
00030 #include <sofa/defaulttype/RigidTypes.h>
00031 #include <vector>
00032
00033 namespace sofa
00034 {
00035
00036 namespace component
00037 {
00038
00039 namespace mapping
00040 {
00041
00042
00043
00044 template <class BasicMapping>
00045 class TubularMapping : public BasicMapping, public virtual core::objectmodel::BaseObject
00046 {
00047 public:
00048 typedef BasicMapping Inherit;
00049 typedef typename Inherit::In In;
00050 typedef typename Inherit::Out Out;
00051 typedef typename Out::VecCoord VecCoord;
00052 typedef typename Out::VecDeriv VecDeriv;
00053 typedef typename Out::Coord Coord;
00054 typedef typename Out::Deriv Deriv;
00055 typedef typename In::Deriv InDeriv;
00056 typedef typename In::SparseDeriv InSparseDeriv;
00057 typedef typename Coord::value_type Real;
00058 enum { M=Coord::static_size };
00059 typedef defaulttype::Mat<M,M,Real> Mat;
00060
00061 typedef defaulttype::Vec<M,Real> Vec;
00062
00063 TubularMapping ( In* from, Out* to )
00064 : Inherit ( from, to )
00065 , m_nbPointsOnEachCircle( initData(&m_nbPointsOnEachCircle, "nbPointsOnEachCircle", "Discretization of created circles"))
00066 , m_radius( initData(&m_radius, "radius", "Radius of created circles"))
00067 {
00068 }
00069
00070 virtual ~TubularMapping()
00071 {}
00072
00073 void init();
00074
00075 virtual void apply ( typename Out::VecCoord& out, const typename In::VecCoord& in );
00076
00077 virtual void applyJ( typename Out::VecDeriv& out, const typename In::VecDeriv& in );
00078
00079 virtual void applyJT ( typename In::VecDeriv& out, const typename Out::VecDeriv& in );
00080
00081
00082
00083 Data<unsigned int> m_nbPointsOnEachCircle;
00084 Data<double> m_radius;
00085
00086 protected:
00087
00088 VecCoord rotatedPoints;
00089
00090 };
00091
00092 }
00093
00094 }
00095
00096 }
00097
00098 #endif