zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
#ifndef OD_GE_CURVE_2D_H
#define OD_GE_CURVE_2D_H /*!DOM*/
 
class OdGePointOnCurve2d;
class OdGeInterval;
class OdGeMatrix2d;
class OdGeLine2d;
class OdGePointOnCurve2dData;
class OdGeBoundBlock2d;
 
#include "Ge/GeEntity2d.h"
#include "Ge/GeIntArray.h"
#include "Ge/GePoint2d.h"
#include "Ge/GePoint2dArray.h"
#include "Ge/GeVector2d.h"
#include "Ge/GeVector2dArray.h"
#include "Ge/GeCurve2dPtrArray.h"
#include "Ge/GeDoubleArray.h"
 
#include "TD_PackPush.h"
 
/** \details
    This class is the base class for all OdGe 2D curves.
 
    Library: TD_Ge
 
   <group OdGe_Classes> 
*/
class GE_TOOLKIT_EXPORT OdGeCurve2d : public OdGeEntity2d
{
public:
  
 
  /** \details
    Returns the parametric interval of the curve.
 
    \param interval [out]  Receives the parametric interval of the curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getInterval(
    OdGeInterval& interval) const;
 
  /** \details
    Returns the parametric interval of the curve.
 
    \param interval [out]  Receives the parametric interval of the curve.
    \param start [out]  Receives the start point of interval.
    \param end [out]  Receives the end point of interval. 
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getInterval(
    OdGeInterval& interval, 
    OdGePoint2d& start,
    OdGePoint2d& end) const;
 
  /** \details
    Reverses the parameter direction this curve.   
 
    \remarks
    The point set of this curve is unchanged.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  OdGeCurve2d& reverseParam();
  
  /** \details
    Sets to natural domain of the curve
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  OdGeCurve2d& setInterval();
 
  /** \details
    Sets the parametric interval of this curve.
 
    \param interval [in]  Parametric interval of this curve
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool setInterval(
    const OdGeInterval& interval);
 
  /** \details
    Returns the distance between the input point and the closest 
    point on this curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  double distanceTo(
    const OdGePoint2d& point,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Returns the distance between the closest points between this 
    curve and the input curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  double distanceTo(
    const OdGeCurve2d& otherCur,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Finds the closest point on this curve to the input point. 
 
    \note
    This function is the same as getClosestPointTo().
  */
  OdGePoint2d closestPointTo(
    const OdGePoint2d& point,
    const OdGeTol& tol = OdGeContext::gTol) const;
  
  /** \details
    Finds the closest points between this curve and the input curve.
 
    \note
    This function is the same as getClosestPointTo().
  */
  OdGePoint2d closestPointTo(
    const OdGeCurve2d& curve2d,
    OdGePoint2d& pntOnOtherCrv,
    const OdGeTol& tol= OdGeContext::gTol) const;
 
  /** \details
    Finds the closest point on this curve to the input point. 
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getClosestPointTo(
    const OdGePoint2d& point,
    OdGePointOnCurve2d& pntOnCrv,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Finds the closest points between this curve and the input curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getClosestPointTo(
    const OdGeCurve2d& curve2d,
    OdGePointOnCurve2d& pntOnThisCrv,
    OdGePointOnCurve2d& pntOnOtherCrv,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Finds the point on the input curve whose normal passes through the input point. 
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool getNormalPoint(
    const OdGePoint2d& point,
    OdGePointOnCurve2d& pntOnCrv,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  TD_USING(OdGeEntity2d::isOn);
 
  /** \details
    Determines if pnt lies on curve. 
    The param parameter is only set to a meaningful value 
    if this function returns true.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isOn(
    const OdGePoint2d& point, 
    double& param,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Determines if input parameter value is within valid parametric range of curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isOn(
    double param,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Returns the parameter value of a point.
 
    \param point [in]  Input point on the curve.
    \param tol [in]  Geometric tolerance.
 
    \remarks
    The returned parameters specify a point within tol of point.
    If point is not on the curve, the results are unpredictable.
    If you are not sure the point is on the curve, use 
    isOn () instead of this function.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  double paramOf(
    const OdGePoint2d& point,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Return the offset of the curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getTrimmedOffset(
    double distance,
    OdGeCurve2dPtrArray& offsetCurveList,
    OdGe::OffsetCrvExtType extensionType = OdGe::kFillet,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Returns true if and only if the curve is closed within the specified tolerance.
 
    \param tol [in]  Geometric tolerance.
  */
  bool isClosed(
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Determines if the curve is periodic. The curve is periodic if and 
    only if it is closed and the two points evalPoint(t) and 
    evalPoint(t+period) are always the same point for all values of t. 
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isPeriodic(
    double& period) const;
 
  /** \details
    Returns true, and a linear entity coincident with this curve,
    if and only if this curve is linear.
 
    \param line [out]  Receives the line coincident with this curve.
    \param tol [in]  Geometric tolerance.
 
    \remarks
    An infinite line is returned, even if this curve is bounded.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isLinear(
    OdGeLine2d& line, 
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Returns the arc length of the curve between the two parameter values.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  double length(
    double fromParam, 
    double toParam,
    double tol
#ifndef SWIG
    = OdGeContext::gTol.equalPoint()
#endif
    ) const;
  
  double length(
    double tol 
#ifndef SWIG
    = OdGeContext::gTol.equalPoint()
#endif
    ) const;
 
  /** \details
    Returns the parameter value of the point whose arc length distance.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  double paramAtLength(
    double datumParam, 
    double length,
    bool posParamDir 
#ifndef SWIG
    = true
#endif
    , double tol 
#ifndef SWIG
    = OdGeContext::gTol.equalPoint()
#endif
    ) const;
 
  /** \details
    Returns the area of the interval of the curve defined by 
    startParam and endParam. 
  */
  bool area(
    double startParam, double endParam,
    double& value, 
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Determines if the curve is degenerate and if so 
    returns type of entity that the curve degenerates. 
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isDegenerate(
    OdGe::EntityId& degenerateType,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Determines if the curve is degenerate and if so returns 
    the entity that the curve degenerates into.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool isDegenerate(
    OdGeEntity2d*& pConvertedEntity,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    Returns two segments that are obtained by splitting the curve 
    at the input parameter value. If the specified parameter value
    does not lie within the parametric interval of the curve or if
    it corresponds to the start or endpoint of the curve, then piece1
    and piece2 are set to null.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getSplitCurves(
    double param, 
    OdGeCurve2d*& piece1,
    OdGeCurve2d*& piece2) const;
 
  /** \details
    Explode curve into its component sub-curves.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool explode(
    OdGeCurve2dPtrArray& explodedCurves,
    OdGeIntArray& newExplodedCurve,
    const OdGeInterval* interval = NULL) const;
 
  /** \details
    Local closest points.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getLocalClosestPoints(
    const OdGePoint2d& point,
    OdGePointOnCurve2d& approxPnt,
    const OdGeInterval* nbhd = NULL,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  void getLocalClosestPoints(
    const OdGeCurve2d& otherCurve,
    OdGePointOnCurve2d& approxPntOnThisCrv,
    OdGePointOnCurve2d& approxPntOnOtherCrv,
    const OdGeInterval* nbhd1 = NULL,
    const OdGeInterval* nbhd2 = NULL,
    const OdGeTol& tol = OdGeContext::gTol) const;
 
  /** \details
    oriented bounding box of curve.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  OdGeBoundBlock2d boundBlock() const;
  OdGeBoundBlock2d boundBlock(
    const OdGeInterval& range) const;
 
  /** \details
    bounding box whose sides are parallel to coordinate axes.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  OdGeBoundBlock2d orthoBoundBlock() const;
  OdGeBoundBlock2d orthoBoundBlock(
    const OdGeInterval& range) const;
 
  /** \details
    Returns true, and the start point, if and only if the parametric interval of the curve has a lower bound.
 
    \param startPoint [out]  Receives the start point of the interval.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool hasStartPoint(
    OdGePoint2d& startPoint) const;
 
  /** \details
    Returns true, and the end point, if and only if the parametric interval of the curve has an upper bound.
 
    \param endPoint [out]  Receives the end point of the interval.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  bool hasEndPoint(
    OdGePoint2d& endPoint) const;
 
  /** \details
    Returns the point on the curve corresponding to the specified parameter value, and the derviatives at that point.
 
    \param param [in]  Parameter to be evaluated.
    \param numDeriv [in]  The number of derivatives to be computed 
                 (should not be set larger than 2). 
    \param derivatives [out] Receives an array of derivatives at the point corresponding to param.
 
    \note
    By default this function throws exception "not Implemented". Should be implemented in derived classes.
  */
  OdGePoint2d evalPoint(
    double param) const;
  OdGePoint2d evalPoint(
    double param, 
    int numDeriv,
    OdGeVector2dArray& derivatives) const;
 
  /** \details
    Returns sample points along this curve and their parameter values in the specified arrays.
 
    \param fromParam [in]  Starting parameter value.
    \param toParam [in]  Ending parameter value.
    \param approxEps [in]  Approximate spacing along a curve.
    pointArray Returns an array of sample points.
    paramArray Returns an array of parameters at each point.
  */
  void getSamplePoints(
    double fromParam, 
    double toParam, 
    double approxEps, 
    OdGePoint2dArray& pointArray, 
    OdGeDoubleArray& paramArray) const;
  void getSamplePoints(
    int numSample, 
    OdGePoint2dArray& pointArray) const;
 
  OdGeCurve2d& operator =(const OdGeCurve2d& curve);
 
  //////////////////////////////////////////////////////////////////////////
  // TD Special :
 
  void getSamplePoints(
    double fromParam, 
    double toParam, 
    double approxEps, 
    OdGePoint2dArray& pointArray, 
    OdGeDoubleArray* pParamArray = NULL) const;
 
  /** \details
    Appends sample points along this curve and their parameter values to the specified arrays.
 
    \param fromParam [in]  Starting parameter value.
    \param toParam [in]  Ending parameter value.
    \param approxEps [in]  Approximate spacing along a curve.
    \param numSample [in]  Number of samples.
    \param pointArray [out]  Receives an array of sample points.
    \param pParamArray [in]  Pointer to an array to receive the parameters at each point.
  */
  void appendSamplePoints(
    double fromParam, 
    double toParam, 
    double approxEps, 
    OdGePoint2dArray& pointArray, 
    OdGeDoubleArray* pParamArray = NULL) const;
 
  void appendSamplePoints(
    int numSample, 
    OdGePoint2dArray& pointArray) const;
 
protected:
  /** \param source [in]  Object to be cloned.
  */
  OdGeCurve2d();
  OdGeCurve2d(
    const OdGeCurve2d& source);
};
 
#include "TD_PackPop.h"
 
#endif // OD_GE_CURVE_2D_H