Method CurveFit
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
CurveFit()
Fits the polyline with a curve, as AutoCAD's CurveFit (PEDIT Fit): a pair of arcs on each segment, meeting at a
vertex the fitting adds (flag 1 of its group 70) after the vertex the segment leaves, so that the curve passes through
every vertex in the direction its tangent gives there; flag 2 of the polyline's group 70. The tangent is the one the
vertex is given (TangentUsed, which the added vertex's Tangent
copies); at an end of an open polyline that of the circle through the first or last three vertices; and between,
AutoCAD's blend of the segments either side, each weighted by the turn at the far end of the other, so that a vertex
after two on a line is fitted along that line: on (0, 0), (100, 0), (100, 50), (0, 80) the tangent at (100, 0) is
64.41 degrees, not the 63.43 of the circle through it and its neighbours. Where the tangents at a segment's ends are
either side of it, its arcs meet where the curve runs along the chord; where they are on one side (an S), the arcs'
radii are as the sines of the tangents' angles to the chord. A segment whose tangent at either end is within a
millionth of a radian of its line stays straight, with no vertex added, as do the two vertices of a polyline of two;
and two vertices on one point split the curve in two there. Every vertex and bulge is AutoCAD 2021's to 1E-11. A
segment's widths run along its two arcs, the width at the joint read off at the first arc's share of their length, as
AutoCAD reads it: a segment from width 1 to 3 whose first arc is 25.723 long and second 24.733 is 2.0197 wide at the
joint. A fitted polyline is straightened first. Each vertex of the frame keeps its handle.
public void CurveFit()
Exceptions
- InvalidOperationException
Thrown when the polyline has fewer than two vertices, or is erased.