/* [<][>][^][v][top][bottom][index][help] */
1 #ifndef _CYLINDER_MESH_HPP_
2 #define _CYLINDER_MESH_HPP_
3
4 #include <osg/Shape>
5 #include <osg/Geometry>
6 #include <osg/Geode>
7 #include <osg/Vec3d>
8 #include <osg/ShapeDrawable>
9 #include <osg/ref_ptr>
10 #include <osgViewer/Viewer>
11 #include <osgGA/TrackballManipulator>
12 #include <osgViewer/ViewerEventHandlers>
13 #include <osgUtil/Optimizer>
14 #include <osgUtil/SmoothingVisitor>
15 #include <osg/LOD>
16
17 #include <cmath>
18 #include <chrono>
19 #include <fstream>
20 #include <iostream>
21 #include <tuple>
22 #include <algorithm>
23 #include <unordered_map>
24 #include <string>
25 #include <vector>
26
27
28 #include "utility/record.hpp"
29 using namespace std;
30 using namespace osg;
31
32 class CylinderMesh
33 {
34 public:
35
36 CylinderMesh();
37
38 float
39 angle(Vec3f& vector1, Vec3f& vector2);
40
41 void
42 operator()( Vec3f center
43 , float upper_radius
44 , float lower_radius
45 , float height
46 , Vec3f direction
47 , Geometry * geometry
48 , unsigned int points
49 , const Vec4& color
50 , Vec3f parent
51 );
52
53 Geometry *
54 operator()( Vec3f center
55 , float upper_radius
56 , float lower_radius
57 , float height
58 , Vec3f direction
59 , unsigned int points
60 , const Vec4& color
61 , Vec3f parent
62 );
63
64 void
65 operator()( Vec4f distal
66 , Vec4f proximal
67 , Geometry * geometry
68 , unsigned int points
69 , const Vec4& color
70 , Vec3f parent
71 );
72
73 Geometry *
74 operator()( Vec4f distal
75 , Vec4f proximal
76 , unsigned int points
77 , const Vec4& color
78 , Vec3f parent
79 );
80
81
82 private:
83
84 unordered_map< unsigned int
85 , const tuple< const Vec3Array * const
86 , const DrawElementsUShort * const
87 , const Vec3Array * const
88 >
89 > cylinders;
90
91 const tuple< const Vec3Array * const
92 , const DrawElementsUShort * const
93 , const Vec3Array * const
94 >
95 unit(unsigned int points = 10);
96 };
97
98 #endif /* _CYLINDER_MESH_HPP_ */