The Ge library includes representation for composite curves, which are a set of numbers of end-to-end connected curves. Each component curve of the composite curve is a bounded non-closed curve, and neither infinite lines nor rays can be used as component curves. All component curves of 2D composite curves must lie on the same plane, and 3D curves can consist of curves that are not on the same plane.
Composite curves in 2D and 3D space are represented by the OdGeCompositeCurve2d and OdGeCompositeCurve3d classes respectively. This topic describes the most commonly used operations with 3D composite curves; the functionality of 2D curves is similar to that of 3D.
An OdGeCompositeCurve3d object contains a list of pointers to the component curves. The parameter at the start of the composite curve is 0.0. The parameter at any point along the composite curve is the approximate length of the composite curve up to that point.
A composite curve can be constructed using one of the following constructors:
All curves from the curves array must be connected at their end points; constructors don't check.
For example, the following creates a composite curve that consists of two line segments:
OdGeCurve3dPtrArray curve3dArray;
OdGeLineSeg3d curve1(OdGePoint3d(0,0,0), OdGePoint3d(0,1,0));
OdGeLineSeg3d curve2(OdGePoint3d(0,1,0), OdGePoint3d(4,1,0));
curve3dArray.append(&curve1);
curve3dArray.append(&curve2);
OdGeCompositeCurve3d compCurve3d(curve3dArray);
The OdGeCompositeCurve3d is derived from the OdGeCurve3d class, so composite curve objects support common 3D curve functionality and additionally contain a set of specific methods.
You can get the list of all component curves using getCurveList() method that gets an array of pointers to subcurves comprising the composite curve:
OdGeCurve3dPtrArray curves;
compCurve3d.getCurveList(curves);
To set the subcurves list, use the setCurveList() method, which has two signatures that are equal to constructor signatures:
OdGeCompositeCurve3d& setCurveList(const OdGeCurve3dPtrArray& curveList);
OdGeCompositeCurve3d& setCurveList(const OdGeCurve3d* subCurves, OdUInt32 number);
Using the globalToLocalParam() you can get a parameter value on a subcurve, and the index of that subcurve corresponding to the specified parameter on the whole composite curve:
double local = compCurve3d.globalToLocalParam(4.0, index);
Backwards, localToGlobalParam() returns the parameter on the composite curve corresponding to the specified parameter on the subcurve with a given index:
double global = compCurve3d.localToGlobalParam(1.0, 0)
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|