Two-Dimensional Contour MbContour
The MbContour class is declared in the cur_contour.h file.
The two-dimensional contour MbContour is described by a set of RPArray<MbCurve> segments of curves joined to each other and by the curve closedness attribute closed.
A two-dimensional contour is a composite curve. Unlike other curves, a contour can have breaks. The curves forming a contour will be called segments. The following conditions are satisfied for contour segments: the beginning of each subsequent segment coincides with the end of the previous segment. For a periodic contour, the beginning of the first segment coincides with the end of the last segment. If a contour contains only one segment of one of the following types, it is considered nonperiodic: MbLine, MbLineSegment, MbCosinusoid.
To check the closedness and continuity of contour points with a specified tolerance, use the IsClosedContinuousC0() method. The method checks the coincidence of the first and last contour points, as well as the coincidence of the end of each segment with the beginning of the next one. The check does not require smooth joining of segments. By default, the tolerance 5.0 * PARAM_NEAR is used.
The initial value of the contour parameter is zero: tmin = 0. The parametric length of a contour is equal to the sum of the parametric lengths of its constituent segments:
where wi min and wi max are the minimum and maximum parameter values of the i-th segment. When calculating the radius-vector of a contour point, the working segment and the value of its local parameter are first determined from the parameter value. Then, the radius-vector of the working segment is calculated, which serves as the contour radius-vector.
In the method
PointOn( double & t,
MbCartPoint & r )
the curve radius-vector r is described by the vector function
where segments[k]( wk ) is the working contour segment with index k, and wk is the working segment parameter equal to
The segment with index k is determined from the contour parameter t according to the condition
where wi min and wi max are the minimum and maximum parameter values of the i-th segment.
The contour is shown in the figure:
Other two-dimensional contours must not be used as segments of a two-dimensional contour. If a contour needs to be constructed based on other contours, the latter must be considered as a set of their constituent curves rather than as individual curves.