vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MTControlPoint.h
Go to the documentation of this file.
1 #ifndef _DA_CONTROL_POINT_H
2 #define _DA_CONTROL_POINT_H
3 
4 
5 #include "SimpleBox.h"
6 
8 
11 class DAGizmo : public osg::Referenced
12 {
13 public:
14  DAGizmo(osg::Group *p_EOOwner, osg::Vec3 position, osg::Vec3 tangent, osg::Vec3 normal, osg::Vec3 binormal, double radius);
15  ~DAGizmo();
16 
17  osg::ref_ptr <SimpleBox> getNormal() { return this->normal; }
18  osg::ref_ptr <SimpleBox> getBinormal() { return this->binormal; }
19 
20  bool isVisible() { return this->visibility; }
21  void hide();
22  void show();
23 
24 private:
25  osg::Group *visualsOwner;
26 
27  bool visibility;
28 
29  //for visualizing Frenet frame
30  osg::ref_ptr <SimpleBox> tangent;
31  osg::ref_ptr <SimpleBox> normal;
32  osg::ref_ptr <SimpleBox> binormal;
33 
34 };
35 
36 
38 
46 class DAControlPoint : public osg::Referenced
47 {
48 public:
49 
50  DAControlPoint(DAControlPointType p_type, osg::Group *p_EOOwner, osg::Vec3 point, osg::Quat orient);
52 
53  //not used
54  //create new SimpleBox, make it visible
55  //void createVisualBox(osg::Vec3 size=osg::Vec3(VISUALS_WIDTH, VISUALS_WIDTH, VISUALS_WIDTH), bool movable=true, osg::Vec4 colour = osg::Vec4(1.0, 1.0, 1.0, 1.0));
56 
57  //gets
58  inline osg::Vec3 getBinormal() { return this->binormal; }
59  inline double getCurvature() { return this->curvature; }
60  inline osg::Vec3 getNormal() { return this->normal; }
61  inline osg::Quat getOrientation() { return this->orientation; }
62  inline osg::Vec3 getPosition() { return this->position; }
63  inline double getPriority() { return this->priority; }
64  inline double getSegmentLength() { return this->segmentLength; }
65  inline double getSpeed() { return this->speed; }
66  inline osg::Vec3 getTangent() { return this->tangent; }
67  inline double getTorsion() { return this->torsion; }
68  inline double getTvalue() { return this->tvalue; }
69  inline DAControlPointType getType() { return this->type; }
70  inline osg::Group * getVisualOwner() {return this->visualsOwner; }
71  string getPositionString();
72 
73  //sets
74  void setCharacteristics(osg::Vec3 tan, osg::Vec3 norm, osg::Vec3 binorm, double curvature, double torsion);
75  inline void setNormal(osg::Vec3 nrml) {this->normal = nrml; }
76  inline void setBinormal(osg::Vec3 binrml) {this->binormal = binrml; }
77  void setPosition(osg::Vec3 pos);
78  void setPosition(osg::Vec3f::value_type x, osg::Vec3f::value_type y, osg::Vec3f::value_type z);
79  inline void setPriority(double prior) {this->priority = prior; }
80  inline void setSegmentLength(double length) { this->segmentLength = length; }
81  inline double setSpeed(double spee) { this->speed = spee; }
82  inline void setTangent(osg::Vec3 tngt) { this->tangent = tngt; }
83  inline void setTvalue(double tval) {this->tvalue = tval; }
84  inline void setVisibleVisualBox(bool vis);
85 
87  void showGizmo(bool show);
88 
89 
92 
93 private:
94 
95  //type of this point
96  DAControlPointType type;
97 
102  double tvalue;
103 
104  osg::Vec3 position;
105 
106  //not used
107  //TODO remove if not-used
108  osg::Quat orientation;
109 
110  //Computed characteristics
111  osg::Vec3 tangent;
112  osg::Vec3 normal;
113  osg::Vec3 binormal;
114 
116  double curvature;
118  double torsion;
119 
129  double speed;
130 
132  /*
133  * at first is the same as speed
134  * when some points are added or remove, this parameter must be recalculated
135  */
136  double segmentLength;
137 
139 
143  double priority;
144 
145 
146  //visuals related variables
147  osg::Group *visualsOwner;
148  bool visibleVisualBox;
149 
150  osg::ref_ptr <SimpleBox> visualBox;
151 
152  osg::ref_ptr<DAGizmo> gizmo; //graphical gizmo
153 
154 
155 
156 };
157 
158 
159 #endif //_DA_CONTROL_POINT_H