OpenCOVER
coVR3DTransGizmo.h
Go to the documentation of this file.
1
2#ifndef _CO_VR_3D_TRANS_GIZMO
3#define _CO_VR_3D_TRANS_GIZMO
4
5#include "coVR3DGizmoType.h"
6
7/* ToDo;
8 - if ray of pointer and axis are almost parallel and the closest point between two lines is far away then the gizmo disappears
9*/
10namespace opencover
11{
12
13class PLUGIN_UTILEXPORT coVR3DTransGizmo : public coVR3DGizmoType
14{
15private:
16 const float _arrowLength{5.0f};
17
18 bool _translateXonly{false}, _translateYonly{false}, _translateZonly{false};
19 bool _translateXYonly{false}, _translateXZonly{false}, _translateYZonly{false};
20
21 osg::ref_ptr<osg::MatrixTransform> axisTransform;
22 osg::ref_ptr<osg::MatrixTransform> xAxisTransform;
23 osg::ref_ptr<osg::MatrixTransform> yAxisTransform;
24 osg::ref_ptr<osg::MatrixTransform> zAxisTransform;
25 osg::ref_ptr<osg::MatrixTransform> xConeTransform;
26 osg::ref_ptr<osg::MatrixTransform> yConeTransform;
27 osg::ref_ptr<osg::MatrixTransform> zConeTransform;
28 osg::ref_ptr<osg::MatrixTransform> xyPlaneTransform;
29 osg::ref_ptr<osg::MatrixTransform> xzPlaneTransform;
30 osg::ref_ptr<osg::MatrixTransform> yzPlaneTransform;
31
32 osg::ref_ptr<osg::Geode> sphereGeode;
33 osg::ref_ptr<osg::Geode> translateXaxisGeode;
34 osg::ref_ptr<osg::Geode> translateYaxisGeode;
35 osg::ref_ptr<osg::Geode> translateZaxisGeode;
36 osg::ref_ptr<osg::Geode> translateXconeGeode;
37 osg::ref_ptr<osg::Geode> translateYconeGeode;
38 osg::ref_ptr<osg::Geode> translateZconeGeode;
39 osg::ref_ptr<osg::Geode> translateXYplaneGeode;
40 osg::ref_ptr<osg::Geode> translateXZplaneGeode;
41 osg::ref_ptr<osg::Geode> translateYZplaneGeode;
42
43 // the point on Line 1(pointer direction) that is nearest to Line 2 (axis direction) is used to calculate the new position
44 osg::Vec3 calculatePointOfShortestDistance(const osg::Vec3& lp0, const osg::Vec3& lp1, osg::Vec3 axis_o) const;
45
46protected:
47 virtual void createGeometry() override;
48
49 // called every time when the geometry is intersected
50 int hit(vrui::vruiHit *hit) override;
51
52public:
53 coVR3DTransGizmo(osg::Matrix m, float s, coInteraction::InteractionType type, const char *iconName, const char *interactorName, coInteraction::InteractionPriority priority, coVR3DGizmo* gizmoPointer = nullptr);
55
56 virtual void startInteraction() override;
57 virtual void doInteraction() override;
58 virtual void stopInteraction() override;
59 virtual void resetState() override;
60
61
62};
63
64}
65#endif
Definition: ARToolKit.h:33
Definition: coVR3DGizmo.h:20
Definition: coVR3DGizmoType.h:22
Definition: coVR3DTransGizmo.h:14
virtual void stopInteraction() override
virtual void doInteraction() override
virtual void startInteraction() override
int hit(vrui::vruiHit *hit) override
virtual void resetState() override
virtual void createGeometry() override
coVR3DTransGizmo(osg::Matrix m, float s, coInteraction::InteractionType type, const char *iconName, const char *interactorName, coInteraction::InteractionPriority priority, coVR3DGizmo *gizmoPointer=nullptr)
Definition: vruiHit.h:21