#include <MechanicalStateController.h>


Public Types | |
| typedef DataTypes::VecCoord | VecCoord |
| typedef DataTypes::VecDeriv | VecDeriv |
| typedef DataTypes::Coord | Coord |
| typedef DataTypes::Deriv | Deriv |
| typedef Coord::value_type | Real |
Public Member Functions | |
| MechanicalStateController () | |
| Default Constructor. | |
| virtual | ~MechanicalStateController () |
| Default Destructor. | |
| void | init () |
| SceneGraph callback initialization method. | |
| void | applyController (void) |
| Apply the controller modifications to the controlled MechanicalState. | |
| virtual std::string | getTemplateName () const |
| Get the template type names (if any) used to instantiate this object. | |
Controller Interface | |
| void | onMouseEvent (core::objectmodel::MouseEvent *mev) |
| Mouse event callback. | |
| void | onOmniEvent (core::objectmodel::OmniEvent *mev) |
| Omni event callback. | |
| void | onBeginAnimationStep () |
| Begin Animation event callback. | |
Accessors | |
| core::componentmodel::behavior::MechanicalState < DataTypes > * | getMechanicalState (void) const |
| Return the controlled MechanicalState. | |
| void | setMechanicalState (core::componentmodel::behavior::MechanicalState< DataTypes > *) |
| Set a MechanicalState to the controller. | |
| unsigned int | getIndex (void) const |
| Return the index of the controlled DOF of the MechanicalState. | |
| void | setIndex (const unsigned int) |
| Set the index of the controlled DOF of the MechanicalState. | |
| void | setMainDirection (const sofa::defaulttype::Vec< 3, Real >) |
| Set the direction of the controlled DOF corresponding to the Mouse vertical axis. | |
| const sofa::defaulttype::Vec < 3, Real > & | getMainDirection () const |
| Return the direction of the controlled DOF corresponding to the Mouse vertical axis. | |
Static Public Member Functions | |
| static std::string | templateName (const MechanicalStateController< DataTypes > *=NULL) |
Protected Types | |
| enum | MouseMode { None = 0, BtLeft, BtRight, BtMiddle, Wheel } |
Protected Attributes | |
| Data< unsigned int > | index |
| Controlled DOF index. | |
| core::componentmodel::behavior::MechanicalState < DataTypes > * | mState |
| Controlled MechanicalState. | |
| sofa::defaulttype::Vec< 3, Real > | mainDirection |
| Direction corresponding to the Mouse vertical axis. Default value is (0.0,0.0,-1.0), Z axis. | |
| DataPtr < sofa::defaulttype::Vec < 3, Real > > | mainDirectionPtr |
| Warning ! Only 3d Rigid DOFs can use this mainDirection. | |
| bool | omni |
| MouseMode | mouseMode |
| int | eventX |
| int | eventY |
| Mouse current position in pixel. | |
| double | omniX |
| double | omniY |
| double | omniZ |
| int | mouseSavedPosX |
| int | mouseSavedPosY |
| Last recorded mouse position. | |
| Vector3 | position |
| Quat | orientation |
Provides a Mouse & Keyboard user control on a Mechanical State. On a Rigid Particle, relative and absolute control is available.
Definition at line 65 of file MechanicalStateController.h.
| typedef DataTypes::Coord sofa::component::controller::MechanicalStateController< DataTypes >::Coord |
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 70 of file MechanicalStateController.h.
| typedef DataTypes::Deriv sofa::component::controller::MechanicalStateController< DataTypes >::Deriv |
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 71 of file MechanicalStateController.h.
| typedef Coord::value_type sofa::component::controller::MechanicalStateController< DataTypes >::Real |
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 72 of file MechanicalStateController.h.
| typedef DataTypes::VecCoord sofa::component::controller::MechanicalStateController< DataTypes >::VecCoord |
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 68 of file MechanicalStateController.h.
| typedef DataTypes::VecDeriv sofa::component::controller::MechanicalStateController< DataTypes >::VecDeriv |
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 69 of file MechanicalStateController.h.
enum sofa::component::controller::MechanicalStateController::MouseMode [protected] |
Definition at line 170 of file MechanicalStateController.h.
| sofa::component::controller::MechanicalStateController< DataTypes >::MechanicalStateController | ( | ) | [inline] |
Default Constructor.
Definition at line 62 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::mainDirection, and sofa::defaulttype::Vec< N, real >::normalize().
| virtual sofa::component::controller::MechanicalStateController< DataTypes >::~MechanicalStateController | ( | ) | [inline, virtual] |
| void sofa::component::controller::MechanicalStateController< DataTypes >::applyController | ( | void | ) | [inline] |
Apply the controller modifications to the controlled MechanicalState.
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 146 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::BtLeft, sofa::component::controller::MechanicalStateController< DataTypes >::BtRight, sofa::component::controller::MechanicalStateController< DataTypes >::eventX, sofa::component::controller::MechanicalStateController< DataTypes >::eventY, sofa::simulation::Visitor::execute(), sofa::core::objectmodel::BaseObject::getContext(), sofa::core::objectmodel::Data< T >::getValue(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getX(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getXfree(), sofa::component::controller::MechanicalStateController< DataTypes >::index, sofa::component::controller::MechanicalStateController< DataTypes >::mainDirection, sofa::component::controller::MechanicalStateController< DataTypes >::mouseMode, sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosX, sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosY, sofa::component::controller::MechanicalStateController< DataTypes >::mState, sofa::component::controller::MechanicalStateController< DataTypes >::omni, sofa::component::controller::MechanicalStateController< DataTypes >::orientation, sofa::component::controller::MechanicalStateController< DataTypes >::position, and sofa::helper::Quater< Real >::rotate().
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::onBeginAnimationStep(), sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent(), and sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
| unsigned int sofa::component::controller::MechanicalStateController< DataTypes >::getIndex | ( | void | ) | const [inline] |
Return the index of the controlled DOF of the MechanicalState.
Definition at line 248 of file MechanicalStateController.inl.
References sofa::core::objectmodel::Data< T >::getValue(), and sofa::component::controller::MechanicalStateController< DataTypes >::index.
| const sofa::defaulttype::Vec< 3, typename MechanicalStateController< DataTypes >::Real > & sofa::component::controller::MechanicalStateController< DataTypes >::getMainDirection | ( | ) | const [inline] |
Return the direction of the controlled DOF corresponding to the Mouse vertical axis.
Definition at line 264 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::mainDirection.
| core::componentmodel::behavior::MechanicalState< DataTypes > * sofa::component::controller::MechanicalStateController< DataTypes >::getMechanicalState | ( | void | ) | const [inline] |
Return the controlled MechanicalState.
Definition at line 232 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::mState.
| virtual std::string sofa::component::controller::MechanicalStateController< DataTypes >::getTemplateName | ( | ) | const [inline, virtual] |
Get the template type names (if any) used to instantiate this object.
Reimplemented from sofa::core::objectmodel::Base.
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 153 of file MechanicalStateController.h.
References sofa::component::controller::MechanicalStateController< DataTypes >::templateName().
| void sofa::component::controller::MechanicalStateController< DataTypes >::init | ( | void | ) | [inline, virtual] |
SceneGraph callback initialization method.
Reimplemented from sofa::core::objectmodel::BaseObject.
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 71 of file MechanicalStateController.inl.
References sofa::core::objectmodel::BaseObject::getContext(), sofa::core::objectmodel::BaseContext::getMechanicalState(), sofa::component::controller::MechanicalStateController< DataTypes >::mainDirectionPtr, sofa::component::controller::MechanicalStateController< DataTypes >::mState, and sofa::component::controller::MechanicalStateController< DataTypes >::omni.
Referenced by sofa::component::controller::EdgeSetController< DataTypes >::init().
| void sofa::component::controller::MechanicalStateController< DataTypes >::onBeginAnimationStep | ( | void | ) | [inline, virtual] |
Begin Animation event callback.
Reimplemented from sofa::component::controller::Controller.
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 138 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::applyController().
| void sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent | ( | core::objectmodel::MouseEvent * | mev | ) | [inline, virtual] |
Mouse event callback.
Reimplemented from sofa::component::controller::Controller.
Reimplemented in sofa::component::controller::EdgeSetController< DataTypes >.
Definition at line 85 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::MechanicalStateController< DataTypes >::BtLeft, sofa::component::controller::MechanicalStateController< DataTypes >::BtRight, sofa::component::controller::MechanicalStateController< DataTypes >::eventX, sofa::component::controller::MechanicalStateController< DataTypes >::eventY, sofa::core::objectmodel::MouseEvent::getPosX(), sofa::core::objectmodel::MouseEvent::getPosY(), sofa::core::objectmodel::MouseEvent::getState(), sofa::core::objectmodel::Data< T >::getValue(), sofa::component::controller::Controller::handleEventTriggersUpdate, sofa::core::objectmodel::MouseEvent::LeftPressed, sofa::core::objectmodel::MouseEvent::LeftReleased, sofa::component::controller::MechanicalStateController< DataTypes >::mouseMode, sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosX, sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosY, sofa::core::objectmodel::MouseEvent::Move, sofa::component::controller::MechanicalStateController< DataTypes >::None, sofa::core::objectmodel::MouseEvent::RightPressed, and sofa::core::objectmodel::MouseEvent::RightReleased.
| void sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent | ( | core::objectmodel::OmniEvent * | mev | ) | [inline, virtual] |
Omni event callback.
Reimplemented from sofa::component::controller::Controller.
Definition at line 123 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::core::objectmodel::OmniEvent::getOrientation(), sofa::core::objectmodel::OmniEvent::getPosition(), sofa::core::objectmodel::OmniEvent::getPosX(), sofa::core::objectmodel::OmniEvent::getPosY(), sofa::core::objectmodel::OmniEvent::getPosZ(), sofa::component::controller::MechanicalStateController< DataTypes >::omni, sofa::component::controller::MechanicalStateController< DataTypes >::omniX, sofa::component::controller::MechanicalStateController< DataTypes >::omniY, sofa::component::controller::MechanicalStateController< DataTypes >::omniZ, sofa::component::controller::MechanicalStateController< DataTypes >::orientation, and sofa::component::controller::MechanicalStateController< DataTypes >::position.
| void sofa::component::controller::MechanicalStateController< DataTypes >::setIndex | ( | const unsigned int | _index | ) | [inline] |
Set the index of the controlled DOF of the MechanicalState.
Definition at line 256 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::index, and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::controller::MechanicalStateController< DataTypes >::setMainDirection | ( | const sofa::defaulttype::Vec< 3, Real > | _mainDirection | ) | [inline] |
Set the direction of the controlled DOF corresponding to the Mouse vertical axis.
Definition at line 272 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::mainDirection.
| void sofa::component::controller::MechanicalStateController< DataTypes >::setMechanicalState | ( | core::componentmodel::behavior::MechanicalState< DataTypes > * | _mState | ) | [inline] |
Set a MechanicalState to the controller.
Definition at line 240 of file MechanicalStateController.inl.
References sofa::component::controller::MechanicalStateController< DataTypes >::mState.
| static std::string sofa::component::controller::MechanicalStateController< DataTypes >::templateName | ( | const MechanicalStateController< DataTypes > * | = NULL |
) | [inline, static] |
Definition at line 158 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::getTemplateName().
int sofa::component::controller::MechanicalStateController< DataTypes >::eventX [protected] |
Definition at line 174 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent().
int sofa::component::controller::MechanicalStateController< DataTypes >::eventY [protected] |
Mouse current position in pixel.
Definition at line 174 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent().
Data< unsigned int > sofa::component::controller::MechanicalStateController< DataTypes >::index [protected] |
Controlled DOF index.
Definition at line 164 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::MechanicalStateController< DataTypes >::getIndex(), and sofa::component::controller::MechanicalStateController< DataTypes >::setIndex().
sofa::defaulttype::Vec<3,Real> sofa::component::controller::MechanicalStateController< DataTypes >::mainDirection [protected] |
Direction corresponding to the Mouse vertical axis. Default value is (0.0,0.0,-1.0), Z axis.
Definition at line 167 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::applyController(), sofa::component::controller::MechanicalStateController< DataTypes >::getMainDirection(), sofa::component::controller::MechanicalStateController< DataTypes >::MechanicalStateController(), and sofa::component::controller::MechanicalStateController< DataTypes >::setMainDirection().
DataPtr< sofa::defaulttype::Vec<3,Real> > sofa::component::controller::MechanicalStateController< DataTypes >::mainDirectionPtr [protected] |
Warning ! Only 3d Rigid DOFs can use this mainDirection.
Definition at line 168 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::init().
MouseMode sofa::component::controller::MechanicalStateController< DataTypes >::mouseMode [protected] |
Definition at line 172 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::onKeyPressedEvent(), sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent(), and sofa::component::controller::EdgeSetController< DataTypes >::onMouseEvent().
int sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosX [protected] |
Definition at line 176 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent().
int sofa::component::controller::MechanicalStateController< DataTypes >::mouseSavedPosY [protected] |
Last recorded mouse position.
Definition at line 176 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onMouseEvent().
core::componentmodel::behavior::MechanicalState<DataTypes>* sofa::component::controller::MechanicalStateController< DataTypes >::mState [protected] |
Controlled MechanicalState.
Definition at line 165 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::draw(), sofa::component::controller::MechanicalStateController< DataTypes >::getMechanicalState(), sofa::component::controller::MechanicalStateController< DataTypes >::init(), and sofa::component::controller::MechanicalStateController< DataTypes >::setMechanicalState().
bool sofa::component::controller::MechanicalStateController< DataTypes >::omni [protected] |
Definition at line 171 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::MechanicalStateController< DataTypes >::init(), and sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
double sofa::component::controller::MechanicalStateController< DataTypes >::omniX [protected] |
Definition at line 175 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
double sofa::component::controller::MechanicalStateController< DataTypes >::omniY [protected] |
Definition at line 175 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
double sofa::component::controller::MechanicalStateController< DataTypes >::omniZ [protected] |
Definition at line 175 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
Quat sofa::component::controller::MechanicalStateController< DataTypes >::orientation [protected] |
Definition at line 178 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
Vector3 sofa::component::controller::MechanicalStateController< DataTypes >::position [protected] |
Definition at line 177 of file MechanicalStateController.h.
Referenced by sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), and sofa::component::controller::MechanicalStateController< DataTypes >::onOmniEvent().
1.5.7.1