vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BrushStrokeControlPoint.h
Go to the documentation of this file.
1 #pragma once
2 #include "SimpleBox.h"
3 
4 
5 namespace APDYNAMICART
6 {
7 
9 
12 class DAGizmo : public osg::Referenced
13 {
14 public:
15  DAGizmo(osg::Group *p_EOOwner, osg::Vec3 position, osg::Vec3 tangent, osg::Vec3 normal, osg::Vec3 binormal, double radius);
16  ~DAGizmo();
17 
18  osg::ref_ptr <SimpleBox> getNormal() { return this->normal; }
19  osg::ref_ptr <SimpleBox> getBinormal() { return this->binormal; }
20 
21  bool isVisible() { return this->visibility; }
22  void hide();
23  void show();
24 
25 private:
26  osg::Group *visualsOwner;
27 
28  bool visibility;
29 
30  //for visualizing Frenet frame
31  osg::ref_ptr <SimpleBox> tangent;
32  osg::ref_ptr <SimpleBox> normal;
33  osg::ref_ptr <SimpleBox> binormal;
34 
35 };
36 
37 
39 
47 class BrushStrokeControlPoint : public osg::Referenced
48 {
49 public:
50 
59  BrushStrokeControlPoint(DAControlPointType p_type, osg::Group *p_EOOwner, osg::Vec3 point, osg::Quat orient);
61 
62  //not used
63  //create new SimpleBox, make it visible
64  //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));
65 
66  //gets
67  inline osg::Vec3 getBinormal() { return this->binormal; }
68  inline double getCurvature() { return this->curvature; }
69  inline double getDiameter() { return this->diameter; }
70  inline osg::Vec3 getNormal() { return this->normal; }
71  inline osg::Quat getOrientation() { return this->orientation; }
72  inline osg::Vec3 getPosition() { return this->position; }
73  inline double getPriority() { return this->priority; }
74  inline double getSegmentLength() { return this->segmentLength; }
75  inline double getSpeed() { return this->speed; }
76  inline osg::Vec3 getTangent() { return this->tangent; }
77  inline double getTorsion() { return this->torsion; }
78  inline osg::Quat getTriangulationAngle() { return this->triangulationAngle; }
79  inline double getTvalue() { return this->tvalue; }
80  inline DAControlPointType getType() { return this->type; }
81  inline osg::Group * getVisualOwner() {return this->visualsOwner; }
82  string getPositionString();
83 
84  bool isSampled();
85 
86 
87  //sets
88  void setCharacteristics(osg::Vec3 tan, osg::Vec3 norm, osg::Vec3 binorm, double curvature, double torsion);
89  void setDiameter( double diam ) {this->diameter = diam; }
90  inline void setNormal(osg::Vec3 nrml) {this->normal = nrml; }
91  inline void setBinormal(osg::Vec3 binrml) {this->binormal = binrml; }
92  void setPosition(osg::Vec3 pos);
93  void setPosition(osg::Vec3f::value_type x, osg::Vec3f::value_type y, osg::Vec3f::value_type z);
94  inline void setPriority(double prior) {this->priority = prior; }
95  void setRotationFrame(osg::Vec3 normal, osg::Vec3 binormal, osg::Vec3 tangent);
96  inline void setSegmentLength(double length) { this->segmentLength = length; }
97  inline double setSpeed(double spee) { this->speed = spee; }
98  inline void setTangent(osg::Vec3 tngt) { this->tangent = tngt; }
99  inline void setTriangulationAngle(osg::Quat angle) { this->triangulationAngle = angle; }
100  inline void setTvalue(double tval) {this->tvalue = tval; }
101  inline void setVisibleVisualBox(bool vis);
102 
104  void showGizmo(bool show);
105 
106 
109 
110 private:
111 
112  //type of this point
113  DAControlPointType type;
114 
119  double tvalue;
120 
121  osg::Vec3 position;
122 
123  //not used
124  //TODO remove if not-used
125  osg::Quat orientation;
126 
127  //Computed characteristics
128  osg::Vec3 tangent;
129  osg::Vec3 normal;
130  osg::Vec3 binormal;
131 
133  double curvature;
135  double torsion;
136 
146  double speed;
147 
149  /*
150  * at first is the same as speed
151  * when some points are added or remove, this parameter must be recalculated
152  */
153  double segmentLength;
154 
156 
160  double priority;
161 
162  // computed in triangulator during compute vertices
163  // used later during compute normals
164  osg::Quat triangulationAngle;
165 
166  //visuals related variables
167  osg::Group *visualsOwner;
168  bool visibleVisualBox;
169 
170  osg::ref_ptr <SimpleBox> visualBox;
171 
172  osg::ref_ptr<DAGizmo> gizmo; //graphical gizmo
173  double diameter;
174 
175 
176 };
177 
178 }