-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplayEdgeFunctors.h
More file actions
304 lines (257 loc) · 7.61 KB
/
Copy pathDisplayEdgeFunctors.h
File metadata and controls
304 lines (257 loc) · 7.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/**
* @file DisplayEdgeFunctors.h
* @author Dan R. Lipsa
* @date 4 March 2010
* @ingroup display
* @brief Functors that display an edge
*/
#ifndef __DISPLAY_EDGE_FUNCTORS_H__
#define __DISPLAY_EDGE_FUNCTORS_H__
#include "DisplayElement.h"
class Disk;
class Edge;
class Face;
class OrientedEdge;
class OrientedFace;
void DisplayEdgeVertices (const Edge& edge,
bool useZPos = false, double zPos = 0);
void DisplayEdgeVerticesNoEnds (const Edge& edge);
void DisplayOrientedEdgeVertices (const boost::shared_ptr<OrientedEdge> oe);
void DisplaySegmentArrow2D (G3D::Vector2 v, G3D::Vector2 center,
float lineWidth,
float onePixelInObjectSpace, bool clamped);
/**
* @brief Display an arrow in VTK style.
*
* Display an arrow from 0,1 along X axis, with shaft = 0.03,
* arrowHeadRadius = 0.1, arrowHeadHeight = 0.35.
* if quadric == 0 it draws a 2D arrow.
*/
void DisplayVtkArrow (G3D::Vector3 where, G3D::Vector3 v,
GLUquadricObj* quadric = 0);
/**
* @brief Represents a segment used to display bubble paths
*/
struct Segment
{
Segment () :
m_perpendicularEnd (SegmentPerpendicularEnd::COUNT),
m_context (false)
{
}
Segment (SegmentPerpendicularEnd::Enum perpendicularEnd,
const G3D::Vector3& beforeBegin,
const G3D::Vector3& begin,
const G3D::Vector3& end,
const G3D::Vector3& afterEnd, bool context) :
m_perpendicularEnd (perpendicularEnd),
m_beforeBegin (beforeBegin),
m_begin (begin),
m_end (end),
m_afterEnd (afterEnd),
m_context (context)
{
}
SegmentPerpendicularEnd::Enum m_perpendicularEnd;
G3D::Vector3 m_beforeBegin;
G3D::Vector3 m_begin;
G3D::Vector3 m_end;
G3D::Vector3 m_afterEnd;
bool m_context;
};
/**
* @brief Displays a segment as a line
*/
class DisplaySegmentLine
{
public:
DisplaySegmentLine () :
m_quadric (0), m_radius (1.0), m_contextRadius (1.0)
{
}
DisplaySegmentLine (GLUquadricObj* quadric, double edgeRadius,
double contextEdgeRadius = 2.0) :
m_quadric (quadric), m_radius (edgeRadius),
m_contextRadius (contextEdgeRadius)
{
}
void operator () (
const G3D::Vector3& begin, const G3D::Vector3& end,
bool context = false);
void operator () (const Segment& segment)
{
operator () (segment.m_begin, segment.m_end, segment.m_context);
}
protected:
GLUquadricObj* m_quadric;
double m_radius;
double m_contextRadius;
};
/**
* @brief Displays a segment as a tube using a quadric
*/
class DisplaySegmentQuadric : public DisplaySegmentLine
{
public:
DisplaySegmentQuadric () : DisplaySegmentLine ()
{
}
DisplaySegmentQuadric (
GLUquadricObj* quadric, double edgeRadius, double contextRadius = 2.0) :
DisplaySegmentLine (quadric, edgeRadius, contextRadius)
{
}
void operator() (const G3D::Vector3& begin, const G3D::Vector3& end);
void operator () (const Segment& segment)
{
operator () (segment.m_begin, segment.m_end);
}
};
/**
* @brief Displays a segment as a tube using OpenGL
*/
class DisplaySegmentTube : public DisplaySegmentLine
{
public:
DisplaySegmentTube () : DisplaySegmentLine ()
{
}
DisplaySegmentTube (GLUquadricObj* quadric, double edgeRadius,
double contextRadius = 2.0) :
DisplaySegmentLine (quadric, edgeRadius, contextRadius)
{
}
void operator() (const Segment& segment);
private:
void displayTube (const Disk& begin, const Disk& end) const;
Disk perpendicularDisk (
const G3D::Vector3& beginEdge, const G3D::Vector3& endEdge,
const G3D::Vector3& origin) const;
Disk angledDisk (
const G3D::Vector3& beforeP, const G3D::Vector3& p,
const G3D::Vector3& afterP, const G3D::Vector3& origin) const;
};
/**
* @brief Displays the first half of a segment using a thick line.
*/
class DisplayThickFirstHalf
{
public:
enum ArrowHeadPosition
{
BASE_MIDDLE,
TOP_END
};
public:
DisplayThickFirstHalf (
GLUquadricObj* quadric = 0,
double baseRadius = 0, double topRadius = 0, double height = 0,
ArrowHeadPosition position = BASE_MIDDLE);
void operator () (const G3D::Vector3& begin, const G3D::Vector3& end);
protected:
protected:
GLUquadricObj* m_quadric;
double m_arrowHeadRadius;
double m_arrowHeadHeight;
double m_shaftRadius;
ArrowHeadPosition m_position;
};
/**
* @brief Displays an arrow head using quadrics
*/
class DisplayArrowHeadQuadric : public DisplayThickFirstHalf
{
public:
DisplayArrowHeadQuadric (
GLUquadricObj* quadric,
double arrowHeadRadius, double shaftRadius, double arrowHeadHeight,
ArrowHeadPosition position = TOP_END);
void operator () (const G3D::Vector3& begin, const G3D::Vector3& end);
G3D::Vector3 GetBasePosition (
const G3D::Vector3& begin, const G3D::Vector3& end);
};
/**
* @brief Displays an oriented segment with a thick first half
*/
class DisplayOrientedSegmentLine : public DisplayThickFirstHalf
{
public:
DisplayOrientedSegmentLine (
GLUquadricObj* quadric = 0,
double baseRadius = 0, double topRadius = 1.0, double height = 0,
ArrowHeadPosition position = BASE_MIDDLE) :
DisplayThickFirstHalf (quadric, baseRadius, topRadius, height, position)
{
}
void operator() (const G3D::Vector3& begin, const G3D::Vector3& end);
};
/**
* @brief Displays an arrow using a quadric
*/
class DisplayArrowQuadric : public DisplayThickFirstHalf
{
public:
DisplayArrowQuadric (
GLUquadricObj* quadric = 0,
double arrowHeadRadius = 0, double shaftRadius = 0,
double arrowHeadHeight = 0, ArrowHeadPosition position = TOP_END);
void operator() (const G3D::Vector3& begin, const G3D::Vector3& end);
};
/**
* @brief Displays an oriented edge that intersects the torus domain
* encoding the boundaries intersected using color.
*/
template <typename DisplayEdge,
typename DisplayThickFirstHalf, bool showDuplicates>
class DisplayEdgeTorus : public DisplayElementFocus
{
public:
DisplayEdgeTorus (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus = FOCUS,
bool useZPos = false, double zPos = 0,
GLUquadricObj* quadric = 0);
void operator () (const OrientedEdge& oe);
void operator() (const boost::shared_ptr<OrientedEdge> oe);
void operator() (const boost::shared_ptr<Edge> e);
protected:
void display (const boost::shared_ptr<Edge> e);
private:
DisplayEdge m_displayEdge;
DisplayThickFirstHalf m_displayArrow;
};
/**
* @brief Displays an edge colored by its color property
*/
template <DisplayElement::TessellationEdgesDisplay tesselationEdgesDisplay =
DisplayElement::DISPLAY_TESSELLATION_EDGES>
class DisplayEdgePropertyColor : public DisplayElementFocus
{
public:
DisplayEdgePropertyColor (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus, bool useZPos = false, double zPos = 0);
void operator () (const boost::shared_ptr<Edge> edge) const;
void operator () (const Edge& edge) const;
void operator() (const boost::shared_ptr<OrientedEdge> oe) const;
};
/**
* @brief Displays an edge as a line strip
*/
class DisplayEdge : public DisplayElementFocus
{
public:
DisplayEdge (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus,
bool useZPos = false, double zPos = 0);
void operator () (const boost::shared_ptr<Edge> edge) const;
void operator () (const Edge& edge) const;
void operator() (const boost::shared_ptr<OrientedEdge> oe) const;
private:
ViewNumber::Enum m_viewNumber;
};
#endif //__DISPLAY_EDGE_FUNCTORS_H__
// Local Variables:
// mode: c++
// End: