Point Cloud Library (PCL)
1.7.0
Main Page
Modules
Namespaces
Classes
surface
include
pcl
surface
3rdparty
opennurbs
opennurbs_polyedgecurve.h
1
/* $NoKeywords: $ */
2
/*
3
//
4
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6
// McNeel & Associates.
7
//
8
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
11
//
12
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
13
//
14
////////////////////////////////////////////////////////////////
15
*/
16
17
#if !defined(ON_POLYEDGECURVE_INC_)
18
#define ON_POLYEDGECURVE_INC_
19
20
class
ON_PolyEdgeSegment
;
21
22
class
ON_CLASS
ON_PolyEdgeCurve
:
public
ON_PolyCurve
23
{
24
ON_OBJECT_DECLARE(
ON_PolyEdgeCurve
);
25
26
public
:
27
ON_PolyEdgeCurve
();
28
~
ON_PolyEdgeCurve
();
29
// default copy constructor and operator= are fine.
30
31
// virtual ON_Object::DestroyRuntimeCache override
32
void
DestroyRuntimeCache
(
bool
bDelete =
true
);
33
34
// virtual ON_Curve::IsClosed override
35
ON_BOOL32
IsClosed
()
const
;
36
37
// virtual ON_Curve::DuplicateCurve override
38
ON_Curve
*
DuplicateCurve
()
const
;
39
40
/*
41
Description:
42
Create a one segment ON_PolyEdgeCurve curve that uses a
43
single edge.
44
*/
45
bool
Create(
46
const
ON_BrepTrim
* trim,
47
const
ON_UUID
& object_id
48
);
49
50
/*
51
Description:
52
Create a one segment ON_PolyEdgeCurve curve that uses a
53
single curve.
54
*/
55
bool
Create(
56
const
ON_Curve
* curve,
57
const
ON_UUID
& object_id
58
);
59
60
int
SegmentCount()
const
;
61
62
ON_PolyEdgeSegment
*
SegmentCurve
(
63
int
segment_index
64
)
const
;
65
66
ON_PolyEdgeSegment
*
operator[]
(
int
)
const
;
67
68
ON_BOOL32
Prepend
(
ON_PolyEdgeSegment
* new_segment );
// Prepend curve.
69
ON_BOOL32
Append
(
ON_PolyEdgeSegment
* new_segment );
// Append curve.
70
ON_BOOL32
Insert
(
71
int
segment_index,
72
ON_PolyEdgeSegment
* new_segment
73
);
74
75
// if the segment is an edge, the following
76
// return non-NULL pointers.
77
const
ON_BrepEdge
* EdgeAt(
double
t)
const
;
78
const
ON_BrepTrim
* TrimAt(
double
t)
const
;
79
const
ON_Brep
* BrepAt(
double
t)
const
;
80
const
ON_BrepFace
* FaceAt(
double
t)
const
;
81
const
ON_Surface
* SurfaceAt(
double
t)
const
;
82
ON_Surface::ISO
IsoType(
double
t)
const
;
83
84
double
EdgeParameter(
double
t)
const
;
85
86
// Test if there are any surface edges in the polyedge
87
bool
ContainsAnyEdges()
const
;
88
// Test if all segments of the polyedge are surface edges
89
bool
ContainsAllEdges()
const
;
90
91
/*
92
Description:
93
See if this polyedge has an edge as one of its segments
94
Parameters:
95
edge - [in] the edge to look for
96
Returns:
97
-1: edge is not in the polyedge
98
>=0: index of first segment that uses the edge
99
*/
100
int
FindEdge(
const
ON_BrepEdge
* edge)
const
;
101
102
/*
103
Description:
104
See if this polyedge has a trim as one of its segments
105
Parameters:
106
trim - [in] the trim to look for
107
Returns:
108
-1: trim is not in the polyedge
109
>=0: index of first segment that uses the trim
110
*/
111
int
FindTrim(
const
ON_BrepTrim
* trim)
const
;
112
113
/*
114
Description:
115
See if this polyedge has a wire curve as one of its segments
116
Parameters:
117
curve - [in] the curve to look for
118
Returns:
119
-1: trim is not in the polyedge
120
>=0: index of first segment that uses the curve
121
*/
122
int
FindCurve(
const
ON_Curve
* curve)
const
;
123
124
125
// OBSOLETE and unreliable. Use FindCurve, FindEdge, or FindTrim
126
//bool Contains( const ON_Curve* curve) const;
127
128
// virtual ON_Curve overrides do nothing
129
// to prevent changing edge
130
ON_BOOL32
SetStartPoint
(
ON_3dPoint
start_point);
131
ON_BOOL32
SetEndPoint
(
ON_3dPoint
end_point);
132
ON_BOOL32
ChangeClosedCurveSeam
(
double
t );
133
ON_BOOL32
PrependAndMatch
(
ON_Curve
*);
134
ON_BOOL32
AppendAndMatch
(
ON_Curve
*);
135
136
// 7-1-03 lw added override to unset cached closed flag
137
// when a segment is removed
138
ON_BOOL32
Remove
();
// remove last
139
ON_BOOL32
Remove
(
int
index);
140
};
141
142
class
ON_CLASS
ON_PolyEdgeSegment
:
public
ON_CurveProxy
143
{
144
ON_OBJECT_DECLARE(
ON_PolyEdgeSegment
);
145
public
:
146
// construction
147
148
ON_PolyEdgeSegment
();
149
~
ON_PolyEdgeSegment
();
150
// default copy constructor and operator= are fine.
151
152
// virtual ON_Object::DestroyRuntimeCache override
153
void
DestroyRuntimeCache
(
bool
bDelete =
true
);
154
155
ON_BOOL32
Write
(
ON_BinaryArchive
& )
const
;
156
157
ON_BOOL32
Read
(
ON_BinaryArchive
& );
158
159
// virtual ON_Curve::IsClosed override
160
ON_BOOL32
IsClosed
()
const
;
161
162
163
// virtual ON_Curve::DuplicateCurve override
164
ON_Curve
*
DuplicateCurve
()
const
;
165
166
/*
167
Description:
168
Creates a polyedge segment that uses the entire edge
169
and has the same domain as the edge.
170
Parameters:
171
trim - [in]
172
Returns:
173
true if successful (edge was valid and trim_index was valid)
174
Remarks:
175
Use ON_Curve::SetDomain, ON_Curve::Trim, ON_Curve::Reverse,
176
etc., to tweak the domain, support, direction etc.
177
*/
178
bool
Create(
179
const
ON_BrepTrim
* trim,
180
const
ON_UUID
& object_id
181
);
182
183
/*
184
Description:
185
Creates a polyedge segment that uses the entire curve
186
and has the same domain as the curve.
187
Parameters:
188
curve - [in]
189
Remarks:
190
Use ON_Curve::SetDomain, ON_Curve::Trim, ON_Curve::Reverse,
191
etc., to tweak the domain, support, direction etc.
192
*/
193
bool
Create(
194
const
ON_Curve
* curve,
195
const
ON_UUID
& object_id
196
);
197
198
const
ON_BrepEdge
* Edge()
const
;
199
const
ON_BrepTrim
*
Trim
()
const
;
200
const
ON_Brep
* Brep()
const
;
201
const
ON_BrepFace
* Face()
const
;
202
const
ON_Surface
* Surface()
const
;
203
ON_Surface::ISO
IsoType()
const
;
204
205
double
EdgeParameter(
double
t)
const
;
206
207
/*
208
Returns:
209
True if this segment has an ON_BrepEdge and the direction of
210
the ON_BrepEdge is the reverse of the direction of the segment.
211
*/
212
bool
ReversedEdgeDir()
const
;
213
214
/*
215
Returns:
216
True if this segment has an ON_BrepTrim and the direction of
217
the ON_BrepTrime is the reverse of the direction of the segment.
218
*/
219
bool
ReversedTrimDir()
const
;
220
221
/*
222
Returns:
223
subdomain of the edge that this segment uses. This can
224
be different than the domain returned by this->Domain().
225
*/
226
ON_Interval
EdgeDomain()
const
;
227
228
/*
229
Returns:
230
subdomain of the trim that this segment uses. This can
231
be different than the domain returned by this->Domain().
232
*/
233
ON_Interval
TrimDomain()
const
;
234
235
// m_object_id = id of a brep or curve object in Rhino
236
ON_UUID
m_object_id
;
237
// When the Rhino object is a brep, m_component_index
238
// refers to either an edge or a trim.
239
ON_COMPONENT_INDEX
m_component_index
;
240
// corresponding domain of the edge - see note below
241
ON_Interval
m_edge_domain
;
242
// corresponding domain of the trim - see note below
243
ON_Interval
m_trim_domain
;
244
245
246
// When m_component_index refers to an ON_BrepTrim, there
247
// are four domains and 4 classes derived from ON_Curve
248
// that play a role in the polyedge segment. It is possible
249
// for all 4 of these domains to be different.
250
//
251
// "this" ON_PolyEdgeSegment is an ON_ProxyCurve. The
252
// evaluation domain of "this" is
253
// = this->Domain()
254
// = ON_ProxyCurve::m_this_domain
255
//
256
// ON_ProxyCurve::m_real_curve points to the curve in the
257
// c3 = ON_Brep::m_C3[edge.m_c3i]. "this" is a proxy for some
258
// sub-interval of c3.
259
// = this->ProxyCurveDomain()
260
// = ON_ProxyCurve::m_real_curve_domain
261
//
262
// The edge, an ON_BrepEdge, is also a proxy based on c3,
263
// and the edge's evaluation domain is edge.m_this_domain.
264
// ON_PolyEdgeSegment::m_edge_domain records the increasing
265
// subinterval of edge.m_this_domain that corresponds
266
// to the portion of c3 "this" is using.
267
//
268
// The trim, an ON_BrepTrim, is a proxy based on a curve
269
// in ON_Brep::m_C2[]. Some portion of the trim corresponds
270
// to the portion of the edge we are using. m_trim_domain
271
// is an increasing, possible subinterval, of the trim's domain
272
// ON_BrepTrim::m_this_domain.
273
274
// Runtime helpers
275
const
void
*
m_parent_object
;
// CRhinoBrepObject or CRhinoCurveObject
276
const
ON_Brep
*
m_brep
;
277
const
ON_BrepTrim
*
m_trim
;
// 2d trim in m_brep
278
const
ON_BrepEdge
*
m_edge
;
// 3d edge in m_brep
279
const
ON_BrepFace
*
m_face
;
280
const
ON_Surface
*
m_surface
;
281
282
private
:
283
friend
class
ON_PolyEdgeCurve
;
284
void
ClearEvalCacheHelper();
285
286
// parameter evaluation cache
287
double
m_t;
288
double
m_edge_t;
289
double
m_trim_t;
290
double
m_srf_uv[2];
291
int
m_trim_hint;
292
int
m_edge_hint;
293
294
// surface evaluation cache
295
int
m_evsrf_hint[2];
296
double
m_evsrf_uv[2];
297
ON_3dPoint
m_evsrf_pt;
298
ON_3dVector
m_evsrf_du;
299
ON_3dVector
m_evsrf_dv;
300
ON_3dVector
m_evsrf_duu;
301
ON_3dVector
m_evsrf_duv;
302
ON_3dVector
m_evsrf_dvv;
303
ON_3dVector
m_evsrf_tan;
304
305
void
Init();
306
};
307
308
#endif