vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BrushStrokeTriangulator.h
Go to the documentation of this file.
1 // #pragma once
2 //
3 // #include "BrushStrokeControlPoint.h"
4 //
5 // namespace APDYNAMICART
6 // {
7 //
8 // typedef osg::ref_ptr<BrushStrokeControlPoint> ref_ptr_DAControlPoint;
9 // typedef osg::ref_ptr<SimpleBox> ref_ptr_SimpleBox;
10 //
11 // class BrushStrokeTriangulator : public osg::Geode
12 // {
13 // public:
14 // BrushStrokeTriangulator(osg::ref_ptr<Brush> br);
15 // ~BrushStrokeTriangulator();
16 //
17 // //TODO only for test - move back to private
18 // //Catmull-Rom interpolation
19 // osg::Vec3 catmullRomInterpolation(double t, osg::Vec3 p0, osg::Vec3 p1, osg::Vec3 p2, osg::Vec3 p3);
20 //
21 // bool computeVertices( std::vector<ref_ptr_DAControlPoint>* controlPoints );
22 // bool computeColours( std::vector<ref_ptr_DAControlPoint>* controlPoints );
23 // //derivation of Catmull-Rom interpolation
24 // osg::Vec3 derivedCRI(double t, osg::Vec3 p0, osg::Vec3 p1, osg::Vec3 p2, osg::Vec3 p3);
25 //
26 // //second derivation of Catmull-Rom interpolation
27 // osg::Vec3 doubleDerivedCRI(double t, osg::Vec3 p0, osg::Vec3 p1, osg::Vec3 p2, osg::Vec3 p3);
28 //
29 // inline bool getHighLighting() { return this->isHighlighted; }
30 //
31 // /// Generate points of cross section in given point, correctly rotated
32 // bool generateCrosssectionVertices(BrushStrokeControlPoint *cpoint);
33 //
34 // /// Change colour of stroke
35 // /*
36 // * used for highlighting - when user point on Brush Stroke
37 // */
38 // osg::Vec4 highlightColour(osg::Vec4 col);
39 //
40 // /// Interpolate set of Vec3 points
41 // /*
42 // * \param controlPoints - set of points to be interpolated
43 // * \param interpolatedPoints - set of interpolated points.
44 // * \param type - type of interpolation - linear, Catmull-Rom, Circle, ...
45 // * \param closed - will be resulting curve closed?
46 // * \param p_steps - number of interpolation steps between two control points
47 // */
48 // void interpolateVec3(std::vector<osg::Vec3>* controlPoints, std::vector<osg::Vec3>* interpolatedPoints, BrushStrokeInterpolationType type, bool closed, int p_steps);
49 //
50 // /// Create set of interpolated points from set of control points
51 // /*
52 // * if (length optimization == false)
53 // * p_steps = number of interpolated points between two control points
54 // * else
55 // * p_steps is recomputed, based on length of segment
56 // */
57 // void interpolate(std::vector<ref_ptr_DAControlPoint>* controlPoints, std::vector<osg::Vec3>* interpolatedPoints, std::vector<double>* tvalues = NULL, int p_steps = 0, bool lengthOptimization = false, bool closed = false);
58 //
59 // void interpolateCrossSection() { interpolateCrossSection(brush, CrossSectionInterpolatedPoints, CrossSectinInterpolatedNormals); };
60 //
61 // void interpolateCrossSection(Brush *brush, std::vector<osg::Vec3> *interpolatedPoints, std::vector<osg::Vec3> *interpolatedNormals);
62 //
63 // void setHighLighting(bool high) { this->isHighlighted = high; }
64 //
65 //
66 // /**
67 // *
68 // * Complete triangulation of Brush Stroke
69 // * successively calls the necessary function for generation of points, normals, colors, triangle strips
70 // *
71 // * should be called only when geometry of brush stroke has changed completely.
72 // * If only one aspect of triangulation have changed (colors, e.g.,), call only "compute..." function.
73 // *
74 // * \param controlPoints set of (possibly interpolated) control points
75 // */
76 // void triangulate(std::vector<ref_ptr_DAControlPoint>* controlPoints);
77 //
78 // //third derivation ...
79 // osg::Vec3 tripleDerivedCRI(double t, osg::Vec3 p0, osg::Vec3 p1, osg::Vec3 p2, osg::Vec3 p3);
80 //
81 //
82 // private:
83 // BrushStrokeTriangulationType triangulationType;
84 // BrushStrokeInterpolationType interpolationType;
85 //
86 // osg::ref_ptr<osg::Geometry> geometry; ///< all geometry of this triangulation
87 // osg::ref_ptr<osg::Vec3Array> vertices; ///< vertices of surface = triangle mesh
88 // osg::ref_ptr<osg::Vec3Array> normals; ///< normals of surface
89 // osg::ref_ptr<osg::Vec4Array> colours; ///< colours of surface
90 //
91 // bool isHighlighted;
92 //
93 //
94 //
95 // //Tube
96 // osg::ref_ptr<Brush> brush;
97 //
98 // std::vector<osg::Vec3> *CrossSectionInterpolatedPoints; ///< points defining shape of cross-section (can be interpolated)
99 // std::vector<osg::Vec3> *CrossSectinInterpolatedNormals; ///< points defining shape of cross-section (can be interpolated)
100 //
101 //
102 // /*
103 // *
104 // * Called trom triangulate() function
105 // * Compute normal for each vertex of triangulation
106 // * \warning Must be called after CompouteVertices() function
107 // * \todo some check if vertices are already computed?
108 // *
109 // * \param controlPoints set of control points
110 // * \return successfulness of creation
111 // */
112 // bool computeNormals( std::vector<ref_ptr_DAControlPoint>* controlPoints );
113 //
114 // /// Computes one particular point between given points
115 // osg::Vec3 interpolatePoint(double t, osg::Vec3 point1, osg::Vec3 point2, osg::Vec3 point0 = osg::Vec3(0.0, 0.0, 0.0), osg::Vec3 point3 = osg::Vec3(0.0, 0.0, 0.0));
116 // bool generatePrimitiveSets( std::vector<ref_ptr_DAControlPoint>* controlPoints );
117 //
118 // bool generateCapsVertices( std::vector<ref_ptr_DAControlPoint>* controlPoints);
119 //
120 // /*
121 // *
122 // *
123 // *
124 // * \param
125 // * \return
126 // */
127 // bool generateCrosssectionNormals( BrushStrokeControlPoint *cpoint );
128 // void computeDiameters( std::vector<ref_ptr_DAControlPoint>* controlPoints );
129 // void generateCapColors( osg::Vec4 startColor, osg::Vec4 endColor );
130 // std::vector<ref_ptr_SimpleBox>* shapes; //for visualization
131 //
132 // };
133 //
134 // }