Point Cloud Library (PCL)
1.7.1
Main Page
Modules
Namespaces
Classes
surface
include
pcl
surface
3rdparty
opennurbs
opennurbs_linecurve.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_GEOMETRY_CURVE_LINE_INC_)
18
#define ON_GEOMETRY_CURVE_LINE_INC_
19
20
class
ON_LineCurve
;
21
class
ON_CLASS
ON_LineCurve
:
public
ON_Curve
22
{
23
ON_OBJECT_DECLARE(
ON_LineCurve
);
24
25
public
:
26
ON_LineCurve
();
27
ON_LineCurve
(
const
ON_2dPoint
&,
const
ON_2dPoint
&);
// creates a 2d line curve
28
ON_LineCurve
(
const
ON_3dPoint
&,
const
ON_3dPoint
&);
// creates a 3d line curve
29
ON_LineCurve
(
const
ON_Line
&);
30
ON_LineCurve
(
const
ON_Line
&,
31
double
,
double
// domain
32
);
33
ON_LineCurve
(
const
ON_LineCurve
&);
34
35
virtual
~
ON_LineCurve
();
36
37
ON_LineCurve
&
operator=
(
const
ON_LineCurve
&);
38
ON_LineCurve
&
operator=
(
const
ON_Line
&);
39
40
/////////////////////////////////////////////////////////////////
41
// ON_Object overrides
42
43
// virtual ON_Object::SizeOf override
44
unsigned
int
SizeOf
()
const
;
45
46
// virtual ON_Object::DataCRC override
47
ON__UINT32
DataCRC
(ON__UINT32 current_remainder)
const
;
48
49
/*
50
Description:
51
Tests an object to see if its data members are correctly
52
initialized.
53
Parameters:
54
text_log - [in] if the object is not valid and text_log
55
is not NULL, then a brief englis description of the
56
reason the object is not valid is appened to the log.
57
The information appended to text_log is suitable for
58
low-level debugging purposes by programmers and is
59
not intended to be useful as a high level user
60
interface tool.
61
Returns:
62
@untitled table
63
true object is valid
64
false object is invalid, uninitialized, etc.
65
Remarks:
66
Overrides virtual ON_Object::IsValid
67
*/
68
ON_BOOL32
IsValid
(
ON_TextLog
* text_log = NULL )
const
;
69
70
void
Dump
(
ON_TextLog
& )
const
;
// for debugging
71
72
ON_BOOL32
Write
(
73
ON_BinaryArchive
&
// open binary file
74
)
const
;
75
76
ON_BOOL32
Read
(
77
ON_BinaryArchive
&
// open binary file
78
);
79
80
/////////////////////////////////////////////////////////////////
81
// ON_Geometry overrides
82
83
int
Dimension
()
const
;
84
85
ON_BOOL32
GetBBox
(
// returns true if successful
86
double
*,
// minimum
87
double
*,
// maximum
88
ON_BOOL32 =
false
// true means grow box
89
)
const
;
90
91
/*
92
Description:
93
Get tight bounding box of the line.
94
Parameters:
95
tight_bbox - [in/out] tight bounding box
96
bGrowBox -[in] (default=false)
97
If true and the input tight_bbox is valid, then returned
98
tight_bbox is the union of the input tight_bbox and the
99
line's tight bounding box.
100
xform -[in] (default=NULL)
101
If not NULL, the tight bounding box of the transformed
102
line is calculated. The line is not modified.
103
Returns:
104
True if the returned tight_bbox is set to a valid
105
bounding box.
106
*/
107
bool
GetTightBoundingBox
(
108
ON_BoundingBox
& tight_bbox,
109
int
bGrowBox =
false
,
110
const
ON_Xform
* xform = 0
111
)
const
;
112
113
ON_BOOL32
Transform
(
114
const
ON_Xform
&
115
);
116
117
// virtual ON_Geometry::IsDeformable() override
118
bool
IsDeformable
()
const
;
119
120
// virtual ON_Geometry::MakeDeformable() override
121
bool
MakeDeformable
();
122
123
ON_BOOL32
SwapCoordinates
(
124
int
,
int
// indices of coords to swap
125
);
126
127
/////////////////////////////////////////////////////////////////
128
// ON_Curve overrides
129
130
ON_Interval
Domain
()
const
;
131
132
// Description:
133
// Set the domain of the curve
134
// Parameters:
135
// t0 - [in]
136
// t1 - [in] new domain will be [t0,t1]
137
// Returns:
138
// true if successful.
139
ON_BOOL32
SetDomain
(
140
double
t0,
141
double
t1
142
);
143
144
bool
ChangeDimension
(
145
int
desired_dimension
146
);
147
148
int
SpanCount
()
const
;
// number of smooth spans in curve
149
150
ON_BOOL32
GetSpanVector
(
// span "knots"
151
double
*
// array of length SpanCount() + 1
152
)
const
;
//
153
154
int
Degree
(
// returns maximum algebraic degree of any span
155
// ( or a good estimate if curve spans are not algebraic )
156
)
const
;
157
158
ON_BOOL32
IsLinear
(
// true if curve locus is a line segment between
159
// between specified points
160
double
= ON_ZERO_TOLERANCE
// tolerance to use when checking linearity
161
)
const
;
162
163
/*
164
Description:
165
Several types of ON_Curve can have the form of a polyline including
166
a degree 1 ON_NurbsCurve, an ON_PolylineCurve, and an ON_PolyCurve
167
all of whose segments are some form of polyline. IsPolyline tests
168
a curve to see if it can be represented as a polyline.
169
Parameters:
170
pline_points - [out] if not NULL and true is returned, then the
171
points of the polyline form are returned here.
172
t - [out] if not NULL and true is returned, then the parameters of
173
the polyline points are returned here.
174
Returns:
175
@untitled table
176
0 curve is not some form of a polyline
177
>=2 number of points in polyline form
178
*/
179
virtual
180
int
IsPolyline
(
181
ON_SimpleArray<ON_3dPoint>
* pline_points = NULL,
182
ON_SimpleArray<double>
* pline_t = NULL
183
)
const
;
184
185
ON_BOOL32
IsArc
(
// ON_Arc.m_angle > 0 if curve locus is an arc between
186
// specified points
187
const
ON_Plane
* = NULL,
// if not NULL, test is performed in this plane
188
ON_Arc
* = NULL,
// if not NULL and true is returned, then arc parameters
189
// are filled in
190
double
= ON_ZERO_TOLERANCE
// tolerance to use when checking
191
)
const
;
192
193
ON_BOOL32
IsPlanar
(
194
ON_Plane
* = NULL,
// if not NULL and true is returned, then plane parameters
195
// are filled in
196
double
= ON_ZERO_TOLERANCE
// tolerance to use when checking
197
)
const
;
198
199
ON_BOOL32
IsInPlane
(
200
const
ON_Plane
&,
// plane to test
201
double
= ON_ZERO_TOLERANCE
// tolerance to use when checking
202
)
const
;
203
204
ON_BOOL32
IsClosed
(
// true if curve is closed (either curve has
205
void
// clamped end knots and euclidean location of start
206
)
const
;
// CV = euclidean location of end CV, or curve is
207
// periodic.)
208
209
ON_BOOL32
IsPeriodic
(
// true if curve is a single periodic segment
210
void
211
)
const
;
212
213
/*
214
Description:
215
Force the curve to start at a specified point.
216
Parameters:
217
start_point - [in]
218
Returns:
219
true if successful.
220
Remarks:
221
Some end points cannot be moved. Be sure to check return
222
code.
223
See Also:
224
ON_Curve::SetEndPoint
225
ON_Curve::PointAtStart
226
ON_Curve::PointAtEnd
227
*/
228
ON_BOOL32
SetStartPoint
(
229
ON_3dPoint
start_point
230
);
231
232
/*
233
Description:
234
Force the curve to end at a specified point.
235
Parameters:
236
end_point - [in]
237
Returns:
238
true if successful.
239
Remarks:
240
Some end points cannot be moved. Be sure to check return
241
code.
242
See Also:
243
ON_Curve::SetStartPoint
244
ON_Curve::PointAtStart
245
ON_Curve::PointAtEnd
246
*/
247
ON_BOOL32
SetEndPoint
(
248
ON_3dPoint
end_point
249
);
250
251
ON_BOOL32
Reverse
();
// reverse parameterizatrion
252
// Domain changes from [a,b] to [-b,-a]
253
254
ON_BOOL32
Evaluate
(
// returns false if unable to evaluate
255
double
,
// evaluation parameter
256
int
,
// number of derivatives (>=0)
257
int
,
// array stride (>=Dimension())
258
double
*,
// array of length stride*(ndir+1)
259
int
= 0,
// optional - determines which side to evaluate from
260
// 0 = default
261
// < 0 to evaluate from below,
262
// > 0 to evaluate from above
263
int
* = 0
// optional - evaluation hint (int) used to speed
264
// repeated evaluations
265
)
const
;
266
267
// Description:
268
// virtual ON_Curve::Trim override.
269
// Removes portions of the curve outside the specified interval.
270
// Parameters:
271
// domain - [in] interval of the curve to keep. Portions of the
272
// curve before curve(domain[0]) and after curve(domain[1]) are
273
// removed.
274
// Returns:
275
// true if successful.
276
ON_BOOL32
Trim
(
277
const
ON_Interval
& domain
278
);
279
280
// Description:
281
// Where possible, analytically extends curve to include domain.
282
// Parameters:
283
// domain - [in] if domain is not included in curve domain,
284
// curve will be extended so that its domain includes domain.
285
// Original curve is identical
286
// to the restriction of the resulting curve to the original curve domain,
287
// Returns:
288
// true if successful.
289
bool
Extend
(
290
const
ON_Interval
& domain
291
);
292
293
// Description:
294
// virtual ON_Curve::Split override.
295
// Divide the curve at the specified parameter. The parameter
296
// must be in the interior of the curve's domain. The pointers
297
// passed to Split must either be NULL or point to an ON_Curve
298
// object of the same of the same type. If the pointer is NULL,
299
// then a curve will be created in Split(). You may pass "this"
300
// as one of the pointers to Split().
301
// Parameters:
302
// t - [in] parameter in interval Domain().
303
// left_side - [out] left portion of curve
304
// right_side - [out] right portion of curve
305
// Example:
306
// For example, if crv were an ON_NurbsCurve, then
307
//
308
// ON_NurbsCurve right_side;
309
// crv.Split( crv.Domain().Mid() &crv, &right_side );
310
//
311
// would split crv at the parametric midpoint, put the left side
312
// in crv, and return the right side in right_side.
313
ON_BOOL32
Split
(
314
double
t,
// t = curve parameter to split curve at
315
ON_Curve
*& left_side,
// left portion returned here
316
ON_Curve
*& right_side
// right portion returned here
317
)
const
;
318
319
// Description:
320
// virtual ON_Curve::GetNurbForm override.
321
// Get a NURBS curve representation of this curve.
322
// Parameters:
323
// nurbs_curve - [out] NURBS representation returned here
324
// tolerance - [in] tolerance to use when creating NURBS
325
// representation.
326
// subdomain - [in] if not NULL, then the NURBS representation
327
// for this portion of the curve is returned.
328
// Returns:
329
// 0 unable to create NURBS representation
330
// with desired accuracy.
331
// 1 success - returned NURBS parameterization
332
// matches the curve's to wthe desired accuracy
333
// 2 success - returned NURBS point locus matches
334
// the curve's to the desired accuracy but, on
335
// the interior of the curve's domain, the
336
// curve's parameterization and the NURBS
337
// parameterization may not match to the
338
// desired accuracy.
339
int
GetNurbForm
(
340
ON_NurbsCurve
&,
341
double
= 0.0,
342
const
ON_Interval
* = NULL
343
)
const
;
344
345
// Description:
346
// virtual ON_Curve::HasNurbForm override.
347
// Does a NURBS curve representation of this curve exist.
348
// Parameters:
349
// Returns:
350
// 0 unable to create NURBS representation
351
// with desired accuracy.
352
// 1 success - returned NURBS parameterization
353
// matches the curve's to wthe desired accuracy
354
// 2 success - returned NURBS point locus matches
355
// the curve's to the desired accuracy but, on
356
// the interior of the curve's domain, the
357
// curve's parameterization and the NURBS
358
// parameterization may not match to the
359
// desired accuracy.
360
int
HasNurbForm
(
361
)
const
;
362
363
// Description:
364
// virtual ON_Curve::GetCurveParameterFromNurbFormParameter override.
365
// Convert a NURBS curve parameter to a curve parameter
366
//
367
// Parameters:
368
// nurbs_t - [in] nurbs form parameter
369
// curve_t - [out] curve parameter
370
//
371
// Remarks:
372
// If GetNurbForm returns 2, this function converts the curve
373
// parameter to the NURBS curve parameter.
374
//
375
// See Also:
376
// ON_Curve::GetNurbForm, ON_Curve::GetNurbFormParameterFromCurveParameter
377
virtual
378
ON_BOOL32
GetCurveParameterFromNurbFormParameter
(
379
double
nurbs_t,
380
double
* curve_t
381
)
const
;
382
383
// Description:
384
// virtual ON_Curve::GetNurbFormParameterFromCurveParameter override.
385
// Convert a curve parameter to a NURBS curve parameter.
386
//
387
// Parameters:
388
// curve_t - [in] curve parameter
389
// nurbs_t - [out] nurbs form parameter
390
//
391
// Remarks:
392
// If GetNurbForm returns 2, this function converts the curve
393
// parameter to the NURBS curve parameter.
394
//
395
// See Also:
396
// ON_Curve::GetNurbForm, ON_Curve::GetCurveParameterFromNurbFormParameter
397
virtual
398
ON_BOOL32
GetNurbFormParameterFromCurveParameter
(
399
double
curve_t,
400
double
* nurbs_t
401
)
const
;
402
403
/////////////////////////////////////////////////////////////////
404
// Interface
405
406
ON_Line
m_line
;
407
ON_Interval
m_t
;
// domain
408
int
m_dim
;
// 2 or 3 (2 so ON_LineCurve can be uses as a trimming curve)
409
};
410
411
412
#endif