Choreonoid  1.8
SceneDragProjector.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_SCENE_DRAG_PROJECTOR_H
6 #define CNOID_BASE_SCENE_DRAG_PROJECTOR_H
7 
8 #include "SceneWidgetEvent.h"
9 #include "exportdecl.h"
10 
11 namespace cnoid {
12 
13 class SceneDragProjectorImpl;
14 
15 class CNOID_EXPORT SceneDragProjector
16 {
17 public:
19  virtual ~SceneDragProjector();
20 
21  enum DragMode { DRAG_NONE, DRAG_ROTATION, DRAG_TRANSLATION };
22 
23  int dragMode() const;
24  bool isDragging() const;
25 
26  void resetDragMode();
27 
28  void setInitialPosition(const Isometry3& T);
29  void setInitialTranslation(const Vector3& p);
30  void setInitialRotation(const Matrix3& R);
31  const Isometry3& initialPosition() const;
32 
33  // for 1-D rotation
34  void setRotationAxis(const Vector3& axis);
35  const Vector3& rotationAxis() const;
36 
37  // for 1-D translation
38  void setTranslationAxis(const Vector3& axis);
39  const Vector3& translationAxis() const;
40 
41  // for 2-D translation
42  void setTranslationPlaneNormal(const Vector3& normal);
43  void setTranslationAlongViewPlane();
44 
45  bool startRotation(SceneWidgetEvent* event);
46  bool startTranslation(SceneWidgetEvent* event);
47 
48  bool drag(SceneWidgetEvent* event);
49  bool dragRotation(SceneWidgetEvent* event);
50  bool dragTranslation(SceneWidgetEvent* event);
51 
52  const Vector3& projectedPoint() const;
53  const Isometry3& position() const;
54  const Matrix3& rotationMatrix() const;
55  double rotationAngle() const;
56  const AngleAxis& rotationAngleAxis() const;
57  const Vector3& translation() const;
58 
59 private:
60  SceneDragProjectorImpl* impl;
61 };
62 
63 }
64 
65 #endif
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::Matrix3
Eigen::Matrix3d Matrix3
Definition: EigenTypes.h:56
cnoid::AngleAxis
Eigen::AngleAxisd AngleAxis
Definition: EigenTypes.h:64
cnoid::SceneDragProjector
Definition: SceneDragProjector.h:15
cnoid::SceneWidgetEvent
Definition: SceneWidgetEvent.h:15
SceneWidgetEvent.h
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::SceneDragProjector::DragMode
DragMode
Definition: SceneDragProjector.h:21